PDFdesk

Blog · 2026-06-10 · 5 min

Getting good OCR out of a bad scan

Recognition quality is decided before the recogniser runs. Most of the win is in what you feed it.

People tend to treat OCR as a fixed quantity: you run it, and the engine is as good as it is. In practice, the same engine on the same document can produce something usable or something worthless depending entirely on the state of the pages you hand it.

Why skew matters more than it looks

Optical character recognition finds lines of text before it finds characters. It looks for horizontal bands of ink separated by whitespace, then works along each band.

A page rotated by two degrees — which looks perfectly straight to a person, and is entirely normal from a sheet feeder — smears those bands into each other. Over the width of an A4 page, two degrees is about 20 millimetres of vertical drift, which is more than a line height. The bottom of one line ends up alongside the top of the next, and the engine's first job fails before its second one starts.

Straightening first is the single highest-value thing you can do, and it costs seconds.

Contrast, not resolution

The instinct with a poor scan is to scan it again at higher resolution. That helps less than expected. Recognition needs to distinguish ink from paper, and beyond about 300 DPI you are mostly adding pixels to both.

What helps is separation. A faint pencil-and-paper scan, or a phone photograph with uneven lighting, has ink and paper values that sit close together. Raising contrast pushes them apart, and converting to grey removes colour noise that carries no information about the letters. A grey, high-contrast page frequently recognises far better than a colour original at twice the resolution — and it is smaller.

The order that works

1. Remove blank pages. No point recognising nothing, and on a duplex scan that can be half the document. 2. Straighten. 3. Raise contrast, convert to grey. 4. Recognise.

Straighten before enhancing: correcting an angle after you have flattened the page to hard black and white throws away the intermediate tones the rotation needs to look clean.

Reading the confidence score

A good OCR result reports how sure it was, per page. This is more useful than it first appears, because it tells you where to look rather than asking you to proof-read everything.

Pages that score well are usually fine. Pages that score badly are usually badly wrong, not slightly wrong — a page that failed to segment produces confident nonsense. Treat a low score as "this page needs a human", not as "this page has a few typos".

And regardless of score, check numbers and names by hand. OCR confuses characters that look alike — 0 and O, 1 and l, 5 and S, rn and m — and those substitutions are least likely to be caught by context in exactly the places where they matter most. An engine reading prose has grammar to fall back on. An engine reading an account number has nothing.

On doing it locally

Recognition in the browser is slower than sending the file to a server: seconds per page, minutes for a long document. What you get for that is a document that never left your machine. For a contract, a medical record or an internal file, that is usually the correct trade — and it is worth being deliberate about it, because the fast option is fast precisely because it is somewhere else.

Tools this is about