tetrak_ocr.batch

Batch OCR processor.

Scans the workspace/scans/ directory for supported image and PDF files, runs OCR on each one, writes the extracted text to a Markdown file in workspace/processed/, and moves the original file in alongside it.

After processing, each file pair looks like:
workspace/processed/

my-postcard.jpg ← original moved here my-postcard.md ← extracted text

Usage (run from the repository root):

tetrak-ocr batch tetrak-ocr batch –backend auto-local tetrak-ocr batch –backend claude tetrak-ocr batch –backend tesseract –contrast 3.0

Functions

build_ocr_fn(backend[, contrast, psm, auto, ...])

Return the OCR callable for the chosen backend.

main([args])

Parse arguments and process all supported files found in workspace/scans/.

process_file(image_path, ocr_fn[, triaged, ...])

OCR a single file, write Markdown output, and move it to workspace/processed/.

supported_extensions(backend)

File extensions backend accepts.

transcribe_per_page(image_path, ocr_fn)

Transcribe image_path one page at a time, returning a text per page.