Procedures

Running OCR

Synopsis

tesseract imagename outbase [-l lang] [-psm N] [configfile …]

Options

Imagename

The name of the input image. Most image file formats (anything readable by Leptonica) are supported.

Outbase

The basename of the output file (to which the appropriate extension will be appended). By default the output will be named outbase.txt.

-l lang 

The language to use. If none is specified, English is assumed. Multiple languages may be specified, separated by plus characters. Tesseract uses 3-character ISO 639-2 language codes. (See LANGUAGES)

-psm n 

Set Tesseract to only run a subset of layout analysis and assume a certain form of image. The options for N are:

0 = Orientation and script detection (OSD) only.

1 = Automatic page segmentation with OSD.

2 = Automatic page segmentation, but no OSD, or OCR.

3 = Fully automatic page segmentation, but no OSD. (Default)

4 = Assume a single column of text of variable sizes.

5 = Assume a single uniform block of vertically aligned text.

6 = Assume a single uniform block of text.

7 = Treat the image as a single text line.

8 = Treat the image as a single word.

9 = Treat the image as a single word in a circle.

10 = Treat the image as a single character.

-V 

Returns the current version of the Tesseract(1) executable.

Configfile

The name of a config to use. A config is a plaintext file which contains a list of variables and their values, one per line, with a space separating variable from value. Interesting config files include:

hocr – Output in hOCR format instead of as a text file. If this configuration file is not present, you can create and use a plain text file containing the line

tessedit_create_hocr<TAB>T

Nota Bene: The options -l lang and -psm N must occur before any configfile.