Menu

What Windows' built-in OCR is actually good at (and where it falls over)
πŸ“°

What Windows' built-in OCR is actually good at (and where it falls over)

DEV Community: pythonΒ·Eric WangΒ·3 days ago
#VETyd2e1
#devtopython#devto#dev#search#windows
Long article (717 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Most "search inside PDFs" advice assumes every PDF has a text layer. In practice, a folder of contracts or scanned invoices is a mix: some files are exported from Word, some are photos of paper, some are 300-page scans where only page 4 matters.

This post is about the second group. Specifically: what you get for free from the OCR engine that ships with Windows, how to call it from Python, and where it quietly produces garbage.

The engine

Windows 10/11 ships an OCR API in the Windows.Media.Ocr namespace. It runs locally, needs no API key, and supports whatever language packs are installed in Settings β†’ Language.

From Python, the usual route is the winrt projection:

from winrt.windows.media.ocr import OcrEngine from winrt.windows.graphics.imaging import BitmapDecoder, SoftwareBitmap from winrt.windows.storage import StorageFile, FileAccessMode

Enter fullscreen mode

Exit fullscreen mode

You hand it a SoftwareBitmap and get back lines of text with bounding boxes.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.