Loading image processing engine…

Remove Shadows & Fix Perspective from Document Photos

Snap a photo of a document, receipt, or form — then flatten the perspective warp and remove shadow gradients from uneven lighting. Download a clean, flat image or PDF. No upload. No account. Runs entirely in your browser.

1. Choose a photo

📄
Click or drag a document photo here
JPG · PNG · WebP · HEIC / HEIF

How it works

1. Load & decode Your photo (including HEIC from iPhone) is decoded entirely in the browser. Nothing is sent to any server.
2. Corner detection OpenCV.js finds the four corners of the document page using edge detection and contour analysis — the same algorithm used in mobile scanner apps.
3. Perspective warp A homography matrix is computed from the four detected corners and the image is warped to a flat, front-on rectangle — removing any camera angle distortion.
4. Shadow removal Adaptive thresholding (local mean) removes shadows and uneven lighting from phone cameras or desk lamps, producing crisp black text on white — or normalisation keeps colour while flattening gradients.
5. PDF / PNG output The cleaned image is embedded into a standard A4 PDF using pdf-lib (pure JavaScript), or saved directly as PNG/JPEG — all computed locally.
Privacy Your document images are never uploaded. All processing runs in WebAssembly (OpenCV) inside your browser tab. Closing the tab clears everything.

Frequently asked questions

Why does my phone photo of a document look distorted or shadowed?
When you take a photo of a flat document at an angle — rather than directly overhead — the camera introduces perspective distortion: the far edge appears smaller than the near edge, making straight lines look trapezoidal. On top of that, ambient light sources (desk lamps, windows, ceiling lights) create gradients and shadows across the page. This tool corrects both problems: it finds the document corners, geometrically "un-warps" the image, and then uses adaptive thresholding to remove the lighting gradient and produce uniform black text on white.
What is adaptive thresholding and why is it better than a simple brightness/contrast adjustment?
A global brightness adjustment treats every pixel the same — so if one side of the document is bright and the other is in shadow, raising overall brightness blows out the bright side while still leaving the dark side dull. Adaptive thresholding divides the image into small regions and chooses the threshold separately for each local neighbourhood. The result is that text is binarised cleanly even when the lighting changes from corner to corner. The "block size" slider controls how large those local neighbourhoods are: a smaller value (e.g. 15) reacts to very local variations but can create noise on blank areas; a larger value (e.g. 71) smooths more but may miss fine detail. 51 works well for most printed documents.
When should I choose "Normalize + sharpen" instead of "Adaptive threshold"?
Adaptive threshold produces a pure black-and-white (binary) output — ideal for text documents, forms, and receipts where you want crisp, scannable results. Choose "Normalize + sharpen" if your document contains colour (e.g. a coloured form, a certificate with colour logos, or a photo page) and you want to keep the colour while evening out the lighting. Normalise stretches the brightness range to use the full 0–255 scale per channel, effectively lifting shadows without losing colour information, then a mild unsharp mask sharpens fine text.
What if the corner detection gets it wrong?
Auto-detection works best when the document sits on a contrasting background (dark desk, coloured tablecloth) with clear, unobstructed corners. If auto-detection fails — for example on white paper on a white desk — the tool falls back to using the full image boundaries, so you still get shadow removal. For tricky shots, place the document on a dark surface and ensure all four corners are visible in the frame before photographing.
Is HEIC (iPhone) supported?
Yes. iPhone photos in HEIC / HEIF format are automatically converted to JPEG in-browser using the heic2any library before processing. You do not need to convert your files first. Android phones typically shoot in JPEG or WebP, which are supported natively.
What is the output PDF size and quality?
The processed image is placed on an A4 page (210 × 297 mm at 72 dpi equivalence) and fitted to fill the page. The image data embedded in the PDF is lossless PNG for the adaptive threshold (B&W) mode, and JPEG at high quality for the colour normalise mode, keeping file sizes reasonable. If you need a specific DPI or page size, download as PNG and use a PDF printer or Word/LibreOffice to place it on your desired page size.