tetrak_ocr.backends.vision

OCR a single image using Apple’s Vision framework, on macOS.

Vision ships with every Mac since 10.15. It is free, needs no API key, no model download and no network, and Apple states plainly that “all of Vision’s processing happens on the user’s device” — so it sits inside the local-first guarantee exactly as Tesseract does, with none of Tesseract’s system-package installation.

That makes it the cheapest backend in the set for the machines that have it: no weights to fetch on first run, no gigabyte of PyTorch, and a first call that is fast rather than slow. On clean modern typescript it is expected to be strong. On degraded historical print it is unmeasured — there is no published benchmark comparing Vision against Tesseract on archival material, which is the gap this backend exists to close. Run evaluate –all and find out; that is the point of adding it.

Two limits worth knowing before reading its scores:

Languages. Apple publishes no list and the set grows with each OS release, so it must be queried at runtime — supported_languages() does that, and is the only answer worth trusting on a given machine. As a guide to the shape of it, a macOS 15 machine reported 30 codes in August 2026: Latin, Cyrillic, CJK, Thai, Vietnamese and Arabic (ar-SA, ars-SA), with no Armenian, Greek, Hebrew, Georgian or Indic support. For the English-language collections this package was built around that is no constraint; for anything in one of those scripts it is absolute, and the other backends remain the only answer. Armenian in particular is unavailable here, which matters given the open question about Armenian-script material.

Handwriting. Apple has never documented handwriting recognition in Vision. The word does not appear in the API references or the WWDC sessions, and every Apple example is printed matter. Do not read a good score on a typed page as evidence about a manuscript one.

Requires macOS and:

pip install ‘tetrak[vision]’

Usage:

tetrak-ocr ocr workspace/scans/my-postcard.jpg –backend vision

No preprocessing is applied. Vision’s .accurate path is a neural detector that handles rotation, perspective and stylised type itself, so the contrast and page-segmentation work tesseract-auto does has no equivalent here. PDF support is not included: Vision takes images, not documents. Convert pages to images first.

Functions

ocr_image(path, *[, languages, ...])

Extract text from an image using Apple's Vision framework.

supported_languages()

Language codes this Mac's Vision build can recognise.

to_spans(annotations, width, height)

Convert Vision's annotations into the package's coordinate convention.