Tesseract: an Open-Source Optical Character Recognition Engine

Tesseract is a quirky command-line tool that does an outstanding job.

to get results similar to the older dither utility. See the Netpbm documentation for more details.

If your input images are in a format other than TIFF, you can, of course, substitute the appropriate Netpbm tool (such as jpegtopnm) in the pipeline:

$ jpegtopnm < scanned_image.jpg | \
  pamthreshold -threshold=0.8 | 
  pamtopnm | pnmtotiff > result.tif

Netpbm also includes utilities that allow you to clip out portions of an image. Note that most multicolumn formats are very consistent in positioning the columns, which means you can automate the translation of multicolumn text pretty easily as well. For example, if you have a two-column article scanned at 200dpi, you can use The GIMP to locate the x coordinates of the column boundaries. Say the first column starts at about 200 and ends at 700, and the second column starts at 800 and ends at 1200. You could add the following to your processing pipeline:

$ tifftopnm < input.tif | \
  pamcut -left 150 -right 750 | ...
  pnmtotiff > output_left.tif

$ tifftopnm < input.tif | \
  pamcut -left 750 -right 1250 | ...
  pnmtotiff > output_right.tif

and automate the extraction of the columns. Place the combination in a shell script with some looping, and you can process a lot of pages very quickly.


Tesseract is a bare-bones OCR engine. The build process is a little quirky, and the engine needs some additional features (such as layout detection), but the core feature, text recognition, is drastically better than anything else I've tried from the Open Source community. It is reasonably easy to get excellent recognition rates using nothing more than a scanner and some image tools, such as The GIMP and Netpbm.

The Tesseract team currently is working to integrate features such as layout analysis and a GUI interface. It looks as if a commercial-quality open-source OCR solution is finally on the horizon.

Anthony Kay has been a systems programmer, programming instructor, technical writer and application developer. He is currently a computer science graduate student at the University of Oregon in Eugene, Oregon.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The online application Free

Anonymous's picture

The online application Free OCR allows transforming the contents of an image file in a text output format. Though Microsoft Word is not supported currently.

OCR softwares are everywhere

Anonymous's picture

OCR softwares are everywhere nowadays. I prefer online ones they don't need installation and most of them are free, like this one: Free OCR.

Lengthy install?

Anonymousey's picture

How to install? Takes about 3 seconds...
apt-get install tesseract-ocr

Tesseract works really well!

I've been using Tesseract

caballosweb's picture

I've been using Tesseract OCR with a C# program I have made to batch OCR hundreds of documents a server we run. Considering it costs nothing, I am very impressed with the accuracy. It is far superior to GOCR which need the image to have the grey scale adjusted before anything can be done.

Submited by : Bajar Libros

Missing links to the images used in the test

Anonymous's picture

I can't find the links to the images used in the test. It seems very strange to me that Ocrad was unable to recognize even a single character on some of them.

What version of Ocrad did you use? Where the characters at least 20 pixels high as requires the manual of Ocrad? If they were smaller, did you use the "--scale" option of Ocrad? Did you even RTFM?

If you want a good review of free OCR software better see this one for example.


Anonymous's picture

Why not try gscan2pdf, which has support for tesseract?

The OCR data is embedded into the pdf as an annotation. It can be indexed with beagle, for example, and viewed with Adobe's pdf reader. Support for annotations is coming to the free pdf readers as well, I believe.

gscan2pdf also supports unpaper, and I find it an excellent all-around tool for my scanner.


MacPac's picture

would be great if someone could code a program that could take my isight or any usb cam to directly send image to the above mentioned program and convert it into text format, so all i would have to do is hold my text book up against my webcam and get it on my computer. Cheers!

International characters?

Cesar's picture

I've using tesseract for a while and it works great, but it has a major flaw that I haven't been able to overcome, I can't make it recognize international characters (i.e. á,é,í,ó,ú,ñ,Ñ), for example, it changes ó for 6.

Is there a way to make it support other than standard ASCII characters?


open source rules, seriously.

Live tv's picture

Great work, it seems like a lengthy installation however.

Lengthy Installation

Mike's picture

You can OCR documents for free using Tesseract at A Billion Billion - Free OCR for Everyone by just uploading your TIFF files and clicking OCR. No installation this way.

Dead Link

Phil Cooper's picture

The site at abillionbillion.com no longer exists. There is another site, free-ocr.com, that allows one to upload scanned images in a variety of graphics file formats, but it is limited to a maximum of 10 images per hour and there's an upper size limit on the images. The site is supported by ads and donations.

I'm impressed!

pcountry's picture

Wow - it did a really good job, first try out of the box. I built it without turning off TIFF support, and used tesseract-1.04b. I put it in /usr/local/bin. At first I got this:

Error: Unable to open unicharset!

This was fixed by doing this:

$ sudo ln -s /usr/local/bin/tessdata /usr/local/share/tessdata

Then it complained about not recognizing the file format (which was TIFF with no compression). I renamed the file from "text2.tiff" to "text2.tif" and then it was happy. That's just silly, if you ask me.

This is all on Ubuntu Feisty. My original scan was 300 dpi, and I ran it through the GIMP the same as in the article.

Very nice!