CodeKitHub
English
Why photos of book pages fail OCR (and how a few degrees of tilt wrecks accuracy)

Why photos of book pages fail OCR (and how a few degrees of tilt wrecks accuracy)

Published Jul 24, 2026

If you’ve ever tried to convert a photo of a book page to text online and gotten back a wall of garbled nonsense, you’ve probably blamed the wrong thing. It’s tempting to assume old, yellowed paper or bad lighting is the culprit — but in testing, neither of those moved the needle much at all. The real cause is almost always something you can’t see just by looking at the photo: a small camera tilt.

The test: same page, four conditions

To find out what actually breaks OCR (optical character recognition) on real-world book photos, we ran the same block of text through Tesseract — the open-source OCR engine — under four conditions: a clean flat scan, a yellowed/faded page, a photo tilted about 12 degrees, and a tilted photo with a glare highlight added.

Condition Word accuracy
Clean, flat scan 100%
Yellowed, faded page (no tilt) 100%
Tilted ~12° (no discoloration) 67.7%
Tilted ~8° + glare 71.0%

The yellowed page scored identically to the pristine one — full marks. The moment a tilt was introduced, accuracy collapsed by a third, producing exactly the kind of output anyone who’s tried “scan textbook to word” tools has seen: "brow," instead of “brown”, "Chapte,." instead of “Chapter.”, "hidde,," instead of “hidden”.

Why a tiny tilt causes this much damage

OCR engines read text by scanning image rows looking for consistent horizontal bands of ink — that’s the mechanism they use to tell one line of text from the next. On a perfectly level scan, each line of text sits in a tidy horizontal band, and the engine cleanly separates line 1 from line 2 from line 3.

Tilt the page by even 10 degrees, and that clean horizontal band becomes a diagonal smear spanning dozens of pixel rows. The engine’s line-segmentation logic starts merging characters from what should be two separate lines, or splitting a single character across what it thinks are two different lines. The result isn’t “slightly less accurate” — it’s categorically different output, because the fundamental unit the engine reads (a line) no longer corresponds to what’s actually in the image.

This is also why a photo that looks completely readable to you can still produce unreadable OCR output. Your visual system compensates for a 10-degree tilt without any conscious effort — you don’t even register it as tilted. A naive OCR pipeline has no such compensation built in, and reads exactly the pixels it’s given.

The fix: straighten before you recognize, not after

The practical takeaway isn’t “hold your phone more carefully” — a bit of tilt when photographing an open book is nearly unavoidable, since you’re not pressing the page flat against a scanner. The fix is automatic: detect the tilt angle and correct it before running text recognition, not after.

One reliable way to detect the angle without any heavy machine-learning model is the projection profile method: rotate the image through a range of candidate angles, and for each one, measure how “peaky” the row-by-row ink distribution is. At the correct angle, text lines line up into sharp bands (high variance between rows); at any other angle, the ink smears across rows (low variance). The angle that produces the highest variance is the deskew angle.

Running this correction first and then recognizing text brought every one of our tilted test cases back to 100% word accuracy — the same page, the same OCR engine, the only difference being straightening it first.

What this means if you’re digitizing a book

  • Don’t worry about paper condition. Yellowing, mild fading, and slight contrast loss from aging paper barely move accuracy on their own. An old paperback digitizes about as well as a new one.
  • Do worry about the angle. Even a tilt you wouldn’t notice by eye can be the entire difference between usable text and garbage.
  • Glare from a flash matters less than tilt, but still hurts. A bright hotspot on glossy paper can blank out whatever text is under it — angle correction won’t fix a spot where there’s no legible ink to read in the first place.
  • A tool that corrects tilt automatically solves the actual problem. Our book page to text tool runs this exact detection-and-correction step in your browser before recognizing — no upload, no server, and it’s built specifically around the tilt problem rather than assuming you’re feeding it a flat scan.

If you’ve tried OCR on a book photo before and given up because the result was unreadable, the page probably wasn’t the problem — a few degrees of camera angle almost certainly was.

← Back to Blog