Skip to main content

Read text from image

Extract text from an image file (PNG, JPG, TIFF, BMP) or a PDF, or from a region of an image, optionally keeping only the text between two markers.

Command in the OCR toolkit · id ooa.ocr/read_image · 14 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
PathFileYesImage file.
LanguageStringNoengTesseract language(s), e.g. eng, deu or eng+fra.
Page modeNumberNo3Page layout mode: 3 automatic, 6 single block, 7 single line, 11 sparse text.
After textStringNoKeep only the text after the first occurrence of this marker, e.g. Invoice number:.
Before textStringNoKeep only the text before this marker (searched after the after_text marker).
TrimBooleanNotrueRemove spaces and line breaks at the start and end of the result.
ScaleNumberNo1Enlarge the image by this factor (1 to 5) before reading; 2 or 3 helps with small text.
Image modeStringNononePrepare the image: none, gray, or black_white (a simple threshold that often helps with coloured backgrounds).
XNumberNoRegion left in pixels; the whole image when the region is empty.
YNumberNoRegion top in pixels.
WidthNumberNoRegion width in pixels.
HeightNumberNoRegion height in pixels.
PasswordCredentialNoA PDF's password (G4).
PagesStringNoA PDF's pages to read, e.g. 1,3,5-7; every page when empty (G4).

Outputs​

OutputTypeWhat it is
textStringRecognised text.