Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to convert the screenshot given in this Stack Overflow question to a textual representation. I already did it by hand, but I'd like not to have to do that sort of thing again in the future.

The example I give here is an error message, not code. But it contains vaguely code-like text, and I'd also like a solution that handles source code.

Is there any free OCR software that is good at reading source code? Preferably open source, though I'm not totally picky. A free web app might be okay too.

I've tried GOCR and FreeOCR.

With default settings, the result from GOCR comes out like this:

__ _ _ _ _ _ Search

''9__dn: sess_on_st_O [Mn_cjon. sess_on-st_]: C_ot send sess_on coo_e - headers dready sent by (ou_ut st_ed at mome Ja s tenx' O Jpub_c_hdlfac eb o oklfac eb o ok. php : 2) ' ._o ne .i9 ste lu0 .ilm____if9 _ e_ o okif9 _ e_ o ok. _ml) on e _

''9__dn: sess_on_st_O [Mn_cjon.sess_on-st_]: C_ot send sess_on cache _ter - headers dready sent (ou_ut st_ed at mome Ja s tenx' O Jpub_c_hdlfac eb o oklfac eb o ok. php : 2) ' ._o ne .i9 ste lu0 .ilm____if9 _ e_ o okif9 _ e_ o ok. _ml) on e _

F9t9l e_'ol': C to undeMed me_od Facebook::getSess_onO ' .olne.i9stelu0.ilm____if9_e_ookiin(lei._ml) on _e ll

And from FreeOCR it comes out like this:

\'\'r2|ll]j.llgZ session_start() [function.session—start]: Cannot send session cookie — headers already sent by (output started at i"homefasteri>Ji'public_ht1*nl.·'tacebool·¤'taceboo1·c.php:2) in .·ll|ZIl[‘lE'.·-2IStPliIU.:-l]llIJ]i€_llUTI1·-fR(PIJ|ZI|ZIk.·-f7¢I(E']J|J|ZIl{.l1lll] on line 33 \'\'r2|ll]j.llgf session_start() [function.session—start]: Cannot send session cache limiter — headers already sent (output started at i"homefasteri><lJi'public_ht1*nl.·'tacebool·¤'taceboo1·c.php:2) in .·ll|ZIl[‘lE'.·-2IStPliIU.:-l]llIJ]i€_llUTI1·-fR(PIJ|ZI|ZIk.·-f7¢I(E']J|J|ZIl{.l1lll] on line 33 Fatal E'l1|ZIlZ Call to undefined method Facebook::getSession() in .·ll|ZIl[‘lE'.·-2ISTPliIU.:-l1llIJ]i€_llUTI1·-fh(E'].I|ZI|ZIl{.·-i1l|ZlE'I.l]lll] on line 11

If I simply am not using them correctly, can you help me configure either of those to produce good output from source code input?

share|improve this question
The screenshot doesn't actually contains code, only errors messages. –  Ravachol Dec 12 '11 at 13:05
@Ravachol: Possibly a good point, as I might not need something quite as robust for an error message, but I would like a solution that handles both. Maybe my example needs improvement :) –  Merlyn Morgan-Graham Dec 12 '11 at 13:06
Favorited. We use some very expensive OCR engines and if someone finds a free one that can do something as complex as source code (with symbols and all) effectively, I'll buy them a beer! Question: are you planning on using the source after it's ocr'd? You'll never get 100% success, and I can't imagine being the human that has to key the corrections. –  hometoast Dec 12 '11 at 13:20
@hometoast: I plan to use it to fix people's Stack Overflow blunders quickly, where they posted screenshots of code they could have copy/pasted in. I can manually edit it. I just need more accuracy than the mess I've got so far :) –  Merlyn Morgan-Graham Dec 12 '11 at 13:21
@MerlynMorgan-Graham Since you appear to have .NET experience, why not roll your own using MODI? It may suffice for what you need and will also allow some flexibility for cleanup if you so desire. codeproject.com/KB/office/OCRSampleApplication.aspx –  Aaron McIver Dec 12 '11 at 15:07

1 Answer 1

Look into OCRopus. More information can be found from the Google System Blog that discusses

share|improve this answer
Notice the windows tag on my post. I think I saw this before and dismissed it because it was for Linux, and I don't want to have to break out MinGW or Cygwin to get the thing working. Please correct me if I'm wrong. I'd be willing to try it if those are supported targets and foolproof instructions exist. I don't see any mention on the main page... –  Merlyn Morgan-Graham Dec 15 '11 at 21:15
No bins, but now that I've gotten a "we've tried it once, it worked", I will give it a shot :) –  Merlyn Morgan-Graham Dec 15 '11 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.