24

Is there a tool that can recognise text in a scanned document (PNG, JPG) and convert it into a regular text file (DOC, TXT)?

It should

  • Work on Ubuntu and Mac OS X
  • Be free
  • Work with most common image types
17

I have successfully used Tesseract for Optical Character Recognition, on Ubuntu.

It is free, open source and maintained by Google.

While not bad with Latin characters and numbers, it struggles with Japanese characters for instance. You might have to first feed it training data depending on what you want to get recognized.

It can read from a lot of different image formats.

Tesseract UI

  • 2
    Good recommendation! I use that, too. Switched over from Cuneiform – which wasn't bad, but Tesseract performs much better for me. Using it from the commandline, however :) Maybe you could point out where that GUI comes from, and what packages to install (apt-get etc)? – Izzy Feb 10 '14 at 9:14
  • The screenshot is not mine, actually, but it shows the idea. I use Tesseract as a library for Alfresco to perform full-text search on vast amounts of documents. – Nicolas Raoul Feb 10 '14 at 9:17
  • I see. Thanks for the feedback; I thought I might have missed something, as I saw no GUI mentioned by apt-cache search tesseract :) – Izzy Feb 10 '14 at 9:24
  • 1
    +1 Tesseract is the most accurate open-source OCR engine (e.g. splitbrain.org/blog/2010-06/15-linux_ocr_software_comparison) – Franck Dernoncourt Mar 15 '14 at 2:56
  • 1
    @DeerHunter: They might dump it when they are done scanning all libraries :-) – Nicolas Raoul May 22 '14 at 13:24
10

I use OCRfeeder for this. It is free, open-source and runs on Linux (unfortunately there is no pre-compiled executable for OSX, though you might be able to build it from source). By default it runs on the Tesseract engine, although this can be changed.

screenshot screenshot
Screenshots (click them for larger pictures)

I don't have a lot of experience with anything other than plain English, but it works well for me and can read most image formats. It can also open a read PDFs as well.

  • supports importing PDF or graphic files (the latter in different formats, such as JPG, PNG,PPM, PNM, and more)
  • direct scanner support (no auto-feed however, so each page needs to be added separately)
  • supports unpaper for post-processing of scanned images (to adjust them)
  • supports multiple OCR backends, such as Tesseract, CuneiForm, GOCR, Ocrad
  • You can edit the recognized text directly, while the corresponding image is shown along. Supports dictionaries for auto-correction (at least on Linux; couldn't test on other systems) – see the right-hand pane in both screenshots above
  • Exports to PDF (searchable!), ODT (OpenDocument Text for e.g. LibreOffice/OpenOffice – which you then could use to convert into .doc when needed), plain text (.txt), and more
  • Thanks for bringing that up! I'm already using tesseract from the command-line (and like it). Will give OCRfeeder a try. Maybe you can tell something about how it works with multi-page documents (does it?), and whether it has direct scanner support (i.e. I could put a stack of paper in the auto-feeder, hit a button, and out comes a multi-page PDF)? – Izzy Feb 14 '14 at 22:25
  • @Izzy Just remembered your comment. I haven't used it on multi-page documents (I don't have much I need to scan) so YMMV. Thanks for the edit. – Seth Feb 15 '14 at 19:39
  • You're welcome! I've just tried it on one so far. Like the way one can do the corrections (side-by-side). Exported PDFs are quite huge; maybe I've missed a "compress" option for images there. – Izzy Feb 15 '14 at 20:07
2

I use Microsoft OneNote as OCR tool. On Right click against an image It can copy the entire text in images and It also has the capability to search text with in image. It is free and accurate and runs on windows and support almost all image formats.

You can copy the text inside and paste it into a text document.

I am not sure if it works in Ubuntu or not through Wine, as Microsoft Office is now available for Mac OS, OneNote will work on it.

Bonus point is that it supports multiple languages :) English, French, Spanish also

2

If at any time you would like to expand to a commercial product, the LEADTOOLS OCR SDK can extract text from an image with just a few lines of code and you can choose which format to save your text output as (DOC, PDF, TXT, ect...)

The LEADTOOLS OCR engine is capable of setting and extracting text from over 50 languages. To test the LEADTOOLS OCR SDK, there is an online interactive demo found here.

It automatically segments the image to detect zones of text, graphics, or tables on the current page then outputs the extracted information.

Here is a screenshot of the demo OCRing and image and then outputting the text:

ss of demo

Below is an example of how to OCR an image with LEADTOOLS:

   using (RasterCodecs codecs = new RasterCodecs())
   using (RasterImage image = codecs.Load(file))
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
   {
        ocrEngine.Startup(null, null, null, null);
       using (IOcrPage ocrPage = ocrEngine.CreatePage(image, OcrImageSharingMode.None))
       {
           ocrPage.Recognize(null);
           Console.WriteLine(ocrPage.GetText(-1));
       }
   }

Disclaimer: I am an employee of this product.

  • Surely there's a web API instead of a library? – Pacerier Apr 4 '18 at 4:58
  • @Pacerier LEADTOOLS now has a web API, cloud services, that you can use when working with OCR. This would not involve downloading any of the libraries and we give you your first 50 pages to OCR for free. The code itself is very easy to implement as seen here – nvillalobos Nov 27 '18 at 22:49
0

There are few popular OCR command-line tools you can use (I'm not sure if they've GUI):

  • GOCR

    Open-source character recognition. It converts scanned images of text back to text files. GOCR can be used with different front-ends, which makes it very easy to port to different OSes and architectures. It can open many different image formats, and its quality have been improving in a daily basis.

  • OCRopus™ (FAQ) (written in Python, NumPy, and SciPy)

    OCR system focusing on the use of large scale machine learning for addressing problems in document analysis, featuring pluggable layout analysis, pluggable character recognition, statistical natural language modeling, and multi-lingual capabilities.

    The OCRopus engine is based on two research projects: a high-performance handwriting recognizer developed in the mid-90's and deployed by the US Census bureau, and novel high-performance layout analysis methods.

    OCRopus is development is sponsored by Google and is initially intended for high-throughput, high-volume document conversion efforts. We expect that it will also be an excellent OCR system for many other applications.

  • Tessnet2 (Open source, OCR, Tesseract, .NET, DOTNET, C#, VB.NET, C++/CLI)

    Tesseract is a C++ open source OCR engine. Tessnet2 is .NET assembly that expose very simple methods to do OCR. Tessnet2 is under Apache 2 license (like tesseract), meaning you can use it like you want, included in commercial products.

Few others: ABBYY CLI OCR for Linux, Asprise OCR

For more complete list, check: List of optical character recognition software at Wikipedia

See also: wanghaisheng/awesome-ocr - A curated list of promising OCR resources at GitHub.

Related thread: What's the best, simplest OCR solution?

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.