Turn a messy document photo into a clean scan
Most of us no longer own a scanner — we photograph documents with a phone. The trouble is that a handheld photo of a page is rarely usable as-is: there's a shadow across one corner, the page is slightly curled or shot at an angle, and the contrast is muddy so the text looks grey rather than black. Scan cleanup fixes all of that automatically, turning a quick snapshot into a document that looks professionally scanned.
It does this with an AI pipeline built specifically for documents. Rather than a single generic filter, it runs a sequence of targeted stages — shadow removal, dewarping, contrast enhancement, and optional upscaling — each solving one of the problems that make phone photos of paper look bad. You choose which stages to apply, and the work runs on our GPUs so even large, high-resolution scans process quickly.
Shadow removal: an even, white page
The most common defect in a document photo is uneven lighting. Whether it's the shadow of your own hand, a gradient from a nearby lamp, or the darker fall-off toward the edges of the frame, that variation makes the page look dirty and makes downstream OCR less accurate. The deshadow stage models the page's background illumination and divides it out, so the paper becomes a uniform white from corner to corner.
This single step is often the difference between a photo that looks like a snapshot and one that looks like a scan. It's especially valuable for receipts and forms photographed on a desk, where the lighting is almost never flat.
Dewarping: flat pages and straight text
Paper curls, books don't lie flat, and a camera held at any angle introduces perspective distortion. The dewarp stage uses a document-geometry network (DocTr) that understands what a flat page should look like and remaps the image so the text lines become straight and horizontal and the page edges become a true rectangle. It corrects both the physical curl of the paper and the perspective of the shot in one pass.
Flat, straight text isn't just nicer to read — it dramatically improves the accuracy of any OCR you run afterwards, because recognition models are trained on upright, undistorted text. If your only problem is a warped page, you can run dewarp on its own and leave the other stages off.
Contrast enhancement and optional upscaling
Once the page is evenly lit and flat, the enhance-contrast stage sharpens the separation between ink and paper, pushing the background toward pure white and the text toward solid black. The result reads cleanly on screen and prints crisply, and it compresses well because the page is mostly uniform white.
For older or low-resolution scans, the optional 2× upscale runs a super-resolution model that reconstructs detail rather than simply enlarging pixels, recovering legibility in small print. Because each stage is a toggle, you only pay the time cost of the steps your document actually needs.
Where scan cleanup fits in your workflow
Scan cleanup pairs naturally with the rest of the OpusImg document toolkit. Start with the ID card cropper to crop and straighten a card or page, run scan cleanup to remove shadows and sharpen it, then send the result through OCR to make the text searchable. Finally, combine several cleaned pages into a single document with Image to PDF.
Whether you're digitising paperwork for an application, archiving handwritten notes, or just trying to read a faint receipt, the cleanup pipeline gives you a scanner-quality result from nothing more than a phone photo — no flatbed, no app, and no fiddling with sliders.