elefcode
← All guides

Tools · 4 min read

OCR Explained: Getting Accurate Text from Images

Optical character recognition (OCR) turns pictures of text — scans, screenshots, photos of receipts — into text you can copy, search, and edit.

Try it yourself with the related tool.

Extract text from an image →

Advertisement

How OCR works

Modern OCR engines such as Tesseract first clean up the image and find blocks and lines of text. A neural network then reads each line as a sequence of characters, using language models to choose likely words. That is why selecting the correct language improves accuracy so much.

What makes OCR fail

Low resolution, blur, skewed or curved pages, uneven lighting, decorative fonts, and text over images all reduce accuracy. Handwriting is much harder than print. Tables and multi-column layouts can come out in the wrong reading order.

Preparing the image

Scan at 300 DPI, photograph straight-on in even light, and crop to just the text. Converting to greyscale and boosting contrast helps. For screenshots, capture at a larger zoom level instead of upscaling afterwards.

Always proofread

Even good OCR confuses similar characters — 0 and O, 1 and l, rn and m. Check numbers, names, and amounts carefully before relying on extracted text, especially from receipts and invoices.

Related guides