tetrak_ocr.backends.tesseract

OCR a single image file using Tesseract and return the extracted text.

Supports JPEG, PNG, TIFF, and PDF (including multi-page PDFs). Requires Tesseract to be installed on the system (brew install tesseract). PDF support also requires Poppler (brew install poppler).

Usage:

tetrak-ocr ocr <path-to-image> tetrak-ocr ocr <path-to-image> –contrast 3.0 –psm 6 tetrak-ocr ocr <path-to-image> –backend tesseract-auto # auto-configure

Functions

analyse_image(image)

Inspect image characteristics and suggest Tesseract configuration.

ocr_image(path[, contrast, psm, auto, lang])

Extract text from an image or PDF file.

preprocess(image[, contrast])

Prepare an image for OCR by converting to greyscale and boosting contrast.