insonl
← journal

Fix Rotated and Skewed Scans Before OCR Runs

date
27 November 2026
by
Insonl
read
7 min read

A sideways invoice with a complete image can go through OCR after a quarter-turn. A straight invoice with its total cut off needs the original file or a new scan. Make that decision at intake, before a page enters the extraction queue. Give preprocessing three possible outcomes for a page with a defect: correct it and proceed, hold it for review, or request a replacement.

Take a supplier packet with an upside-down invoice, a delivery note fed at a slight angle, and a blank-looking reverse side. Even after the first two pages are straightened, the third still needs a decision. It might be blank by design, or it might carry a faint signature. Keep the original packet, assign each page a stable identifier, and do any correction on a working image. The reviewer should be able to open the original page from the exception.

Check orientation on each rendered page

Render the page the way the OCR worker will see it. For PDFs, confirm whether the renderer already applies the page’s stored rotation before you add a correction. Inspect the direction of the main text rather than using the page’s aspect ratio. A wide delivery note can be upright. A cover sheet can be upright while the next page is upside down.

Tesseract’s page segmentation mode 0 runs orientation and script detection on its own. The detector can return without a result when it finds too few usable characters. On an address label, a signature page or a page dominated by a diagram, keep the proposed orientation open to review when text evidence is weak. A result from the preceding page gives the reviewer context, but require evidence on the page itself before inheriting that rotation automatically. Tesseract page segmentation modes · Tesseract orientation detector source

Apply a quarter-turn automatically only where your test set supports the rule for that kind of page. Keep a sample of correctly oriented landscape pages in that set. An automatic rotation that turns an upright packing list sideways creates the defect it was meant to catch.

Deskew after the page is upright

Deskewing corrects the remaining tilt in a page’s text lines. Tesseract’s documentation identifies excessive skew as a problem for line segmentation. OCRmyPDF also gives the two operations separate controls, with --rotate-pages for orientation and --deskew for a small tilt. Tesseract guidance on deskewing · OCRmyPDF guidance on page rotation

Estimate tilt from several text lines in the main content. Check whether lines in different parts of the page agree before applying one angle to the whole image. A scanner shadow or a slanted logo is weak evidence. If text near the top and bottom needs different corrections, inspect the source for a curled sheet, a fold or a photo taken at an angle.

Leave room around the image when rotating it and inspect the new corners before trimming. Compare the corrected view with the original, especially where a stamp, handwritten note or last line of a table sits near an edge. If the correction clipped it, rebuild the working image from the original with more room. If the supplied scan itself cut through a required field, ask for a complete page.

Check captured detail at the smallest required field

When the physical page size is known, compare it with the pixel dimensions of the scanned image to estimate the effective resolution. For a PDF with an embedded scan, measure the scan itself where possible. Rendering the page at a larger size changes the output dimensions. Check whether a decimal point, faint digit or small print can actually be distinguished in the original image.

Tesseract’s quality guide recommends at least 300 DPI as a starting point for its engine. Use that guidance when testing a scanner preset and set acceptance rules against the fields your workflow needs. When an image has sufficient detail but its text is small, try resizing a working copy and measure the field-level result. If adjacent digits are already blurred together at capture, a higher DPI setting on the same file cannot restore the original digit shapes. Ask for the original digital file when available, or request a higher-quality scan. Tesseract guidance on rescaling

Flag blank-looking pages and suspect edges

To flag possible blanks, look for small groups of marks as well as the amount of foreground across the page. Inspect the image before aggressive cleanup. A mostly white page can still contain a date or signature. A mostly blank page can also have a dark border from the scanner. Tesseract’s quality guide warns that it can mistake dark scan borders for characters. Tesseract guidance on borders

Keep flagged pages in the packet until their role is accounted for. Check duplex settings, the pages on either side and any printed page sequence. Where the layout is familiar, compare the edges against a complete example. Marks cut by the frame, a missing footer or a table ending partway through a row warrant inspection. If you trim a scanner border, verify the required content against the original first. OCRmyPDF’s guide recommends reviewing processed pages because cleanup can remove desirable content. OCRmyPDF guidance on image processing

Preserve the page index even when policy permits skipping OCR for a verified blank reverse. The next step may need to map invoice and supporting pages back to positions in the source packet. Split Multi-Invoice PDFs Before Accounts Payable Review

Tell the operator exactly what needs replacing

What the operator sees What to do
Complete page with clear text and a consistent rotation or tilt Correct the working image, verify the relevant edges, then release the page to OCR.
Conflicting orientation evidence or a possible mark on a blank-looking page Show the original and the proposed correction side by side for review.
Required text missing at a cut edge, hidden under a fold or unreadable in the original scan Request the original file or a replacement scan. Hold any downstream action that requires the missing field.

Give the scanner operator or sender the packet reference, original page number, affected edge or field, and the defect to fix. For a cut-off invoice total, ask for the full invoice page with its bottom edge visible. On arrival, match the replacement to the packet and page, check it again, and record which revision goes to OCR. Keep the superseded image available to reviewers so they can see why the replacement was requested.

Measure whether corrections help the workflow

Use representative scans from each intake channel, including clean pages that should pass without correction. Label the true orientation, whether required content is visible, and the expected intake decision. Include sparse pages, intentional blanks, faint marks and pages that were already cropped on arrival. Compare the original and corrected versions with the same OCR settings. Track which required fields become readable, which correct pages get rotated by mistake and how often operators request a replacement they do not need. Build an OCR Test Set for Mixed Supplier Scans

Keep the preprocessing decision with the page ID and record the applied rotation, the estimated skew and the reason for any hold. Let reviewers look up that history next to extracted fields. A confidence score on recognized words leaves fields outside the frame unaccounted for, so keep page completeness checks in front of the rules for accepting extracted values. Set OCR Confidence Thresholds for Invoice Review

Sources

  • Tesseract documents its page segmentation modes and describes how image scale, skew and borders affect recognition. Improving the quality of the output
  • Tesseract’s orientation detector can skip a page when too few usable characters remain. Orientation detector source
  • OCRmyPDF describes rotation and deskew as separate operations and recommends inspecting processed pages for lost content. OCRmyPDF cookbook

Audit your scan intake

Bring an example of a scan your team could correct and one it had to send back. Use those pages to discuss which checks belong before OCR and what evidence the reviewer needs to release a page. Request a free AI workflow audit