Menu

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

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

DEV Community: opensource·Adisorn Khaokom·2 days ago
#3FOlbbL2
#devtoopensource#devto#dev#d2md#demo
Reading 0:00
15s threshold

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

Enter fullscreen mode

Exit fullscreen mode

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

Enter fullscreen mode

Exit fullscreen mode

I've added line breaks to make that excerpt easier to read.…

Continue reading — create a free account

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