DEV Community

Your Mac already has OCR. d2md puts it in your terminal.

Your Mac already has an OCR engine. d2md lets you use it from the terminal and get Markdown back.

On macOS, the direct OCR mode uses Apple Vision. No API key. No extra OCR model to download. You just need the optional OCR dependencies.

Here's the 42-second demo:

Watch the demo on X if the video doesn't load here.

A real scan, with real mistakes

I tried a scanned page from NASA FACTS about the TIROS satellite. It's a public-domain NASA document available through Wikimedia Commons.

This was the command:

d2md nasa.jpg --ocr --lang latin --stdout

Here, latin means the Latin alphabet used in English. For a Thai document, use --lang thai. Leave out --lang to let d2md detect the script automatically.

Part of the output:

THE TIROS SYSTEM
The TIROS satellite is a cylindrical, 300-pound, 18-sided polygon

I've added line breaks to make that excerpt easier to read. Elsewhere on the page, OCR read TV pictures as IV pictures. So yes, check the output.

More than English

The demo also shows Thai, Japanese, Chinese, and Korean. Those are synthetic sample PDFs, and I ran OCR on each one. They aren't scans of real documents.

The Japanese and Chinese results had mistakes elsewhere too. The video shows selected excerpts, not a full accuracy test.

The run used local d2md 0.1.3. The PyPI release may differ. If you want to try the released OCR package, install it with:

uv tool install "d2md[ocr]"

You can use the Markdown in scripts, search, RAG, or give just the text you need to an AI tool. Code and setup instructions on GitHub. It's open source and MIT-licensed.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.