How can I extract text from images?

I am not talking about scanned files, but garden variety images, such as when you take a high-def picture of a blackboard at class, and it is nicely handwritten; or when you photograph a page from a recipe book and want the recipe in text format.

Any free and open software for that?

I tried tesseract, and the results were awful.


The act of extracting text from images is called OCR and Ubuntu has a wiki page dedicated to OCR. From that page:

Available OCR tools

The Ubuntu Universe repositories contain the following OCR tools:

  1. gocr - A command line OCR
  2. fuzzyocr - spamassassin plugin to check image attachments
  3. libhocr0 - Hebrew OCR
  4. ocrad - Optical Character Recognition program
  5. ocrfeeder - Document layout analysis and optical character recognition system
  6. ocropus - document analysis and OCR system
  7. tesseract-ocr

The Ubuntu multiverse respositories also contain:

  1. cuneiform - multi-language OCR system

Some packages are outdated, but unofficial fresh ones can be found in Alex_P PPA (PPA adding code: ppa:alex-p/notesalexp). If you never used a PPA check how to add software from a PPA.

edit: As shown in comment Clara OCR exists too but it got stuk at Hardy and their website has 2009 as last updated.

  • Do you have experience using any of those for the examples I described? I became a bit sceptical to regular ocr tools for them. Number 7 on the list is the one I tried and was plainly terrible. – Strapakowsky Aug 31 '11 at 9:11
  • If I recall, I tried gocr also, with equivalent terrible results. If you tried with success any of those, what syntax did you use? Thanks. – Strapakowsky Aug 31 '11 at 9:13
  • None whatsoever! I never bothered with OCR :D Freshmeat search shows Clara OCR and tesseract-ocr ;) ( freshmeat.net/search/… ) – Rinzwind Aug 31 '11 at 11:16
  • Am I wrong if I say that successful use of OCR requires knowledge of the process and a careful setup to fit the particular image to be scanned? Thus, if I'm right, bad results might be due to the user and not the software. – N.N. Aug 31 '11 at 11:37
  • OCR works best if you know how the image is created and you are very well versed in using the software that you use (the latter being the reason I never got around to using it). – Rinzwind Aug 31 '11 at 11:43

tesseract-ocr would be the great one compared to all others. For Installation, run the below command

sudo apt-get install tesseract-ocr

Usage is tesseract filename.jpg output.txt, then it will generate output.txt file.

You might consider selecting the appropriate language. In that case, you will need to install tesseract-ocr-LANG package, where LANG is the three-letter ISO 639-2 language code. Right now you have 123 languages on 18.04 repo. Then use for example:

tesseract mySpanishText.jpg output -l spa
  • 1
    Hey, so this does works but is not accurate or I would rather say is 80-85% accurate. Like example for this image: pbs.twimg.com/media/DJs6_pcXkAA2VrN.jpg, it messed up $ sign and also most brackets. Square, round, curly, all brackets are a problem, they never get extracted properly. Do you know of any fix? – Milan Chheda Sep 19 '17 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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