Why your scan came out unreadable, and how to fix it before OCR
You photograph a document, run text recognition on it, and get back something that reads like a ransom note. Half the words are right, numbers have turned into letters, and entire lines are missing. The natural conclusion is that the OCR software is poor.
Usually it is not. Recognition quality is dominated by the quality of the image it receives, and phone photographs of documents fail in a small number of predictable ways. Fix the image and the same software suddenly performs well.
What OCR is actually doing
Text recognition works by finding shapes on the page and matching them against known letterforms. It needs to identify where lines of text run, where each character begins and ends, and which parts of the image are ink and which are paper.
Every one of those steps is fragile. If the lines are not horizontal, line detection struggles. If the contrast between ink and paper is low, character boundaries blur. If a shadow darkens one side of the page, the software may read that side as ink. None of this is exotic — it is exactly what a phone photograph taken indoors produces.
The five things that ruin a scan
- Skew: the page is rotated a few degrees, so text runs slightly downhill and line detection breaks
- Uneven lighting: a shadow across part of the page, usually your own, thrown by the ceiling light behind you
- Low contrast: grey text on off-white paper, common with faded receipts and old carbon copies
- Perspective: photographing at an angle so the page is a trapezoid rather than a rectangle, and letters stretch across it
- Insufficient resolution: a small photograph of a dense page, leaving each character only a handful of pixels
Skew is the most damaging and the easiest to fix. A page rotated even two or three degrees produces noticeably worse recognition, because the software tries to fit horizontal lines to text that is not horizontal.
Capturing a better image in the first place
- Put the document on a flat, plain surface with good contrast against the paper.
- Use daylight from a window if you can, and position yourself so your shadow does not fall across the page.
- Hold the camera directly above the centre of the page, not at an angle from one side.
- Fill the frame with the page, so the resolution is spent on the document rather than the table around it.
- Take two, and check the sharpness of the smallest text before you move on.
Aim for enough resolution that body text is comfortably legible when you zoom in. As a rough guide, the equivalent of 300 dots per inch across the page is a sensible target, and most phone cameras exceed that easily if the page fills the frame.
Straighten, brighten and raise the contrast of a scan before you run recognition on it. Runs in your browser, so your document stays on your device.
Adjust an imageCleaning up an image you already have
When you cannot retake the photograph, work through the problems in this order, because each step makes the next easier to judge.
- Straighten first. Rotate until the lines of text run genuinely horizontal, using a ruled edge or the page border as a reference.
- Crop to the page. Removing the surrounding desk stops the software trying to interpret it and improves automatic contrast handling.
- Raise the contrast until the paper reads as near white and the text as near black, without pushing so far that thin strokes break up.
- Brighten shadowed areas if the lighting was uneven, aiming for consistency across the page rather than maximum brightness.
- Only then run recognition.
That order matters. Adjusting contrast before straightening means judging the result against a crooked image, and cropping after contrast means the surrounding desk has already influenced the adjustment.
Knowing when to stop
Some documents will not recognise well no matter what you do. Handwriting, heavily stylised fonts, faded thermal receipts, dot-matrix printing and text over patterned backgrounds are all genuinely difficult, and no amount of cleanup changes that.
For those, recognise that a searchable scan may not be achievable and decide what you actually need. Often the answer is that you need the figures rather than the text, and typing twelve numbers is faster than fighting an image for an hour.
And always keep the original capture. Cleanup is destructive, and if you push contrast too far you will want to start again from the untouched file rather than from your third attempt.
The tool for this
Adjust Image
Brightness, contrast, grayscale & more.