Enhance Scanned PDF, Deskew & Clean Up
Enhance, deskew, despeckle and auto-orient scanned PDFs
Enhance, deskew, despeckle and auto-orient scanned PDFs
Files are processed only in this browser. Nothing is uploaded to a server.
Sharpen scanned PDFs by removing yellowed paper, boosting contrast or converting to black & white
This PDF is password-protected.
Continue in another tool
Processing…
Everything runs inside this browser. Your file is never sent to a server.
Your file is ready to download
Continue with this result
Open page preview
Changing a setting hides the previous result. Run it again to save the latest settings.
Remove the password from an encrypted PDF first. Processing focuses on page content, so bookmarks, attachments, forms and signatures may not be preserved. Keep the original and check the result.
Loading…
Working…
0.0
It hasn't frozen — the result will appear when the calculation finishes.
About Enhance Scanned PDF, Deskew & Clean Up
Scan enhancement has five tabs. Enhance handles paper colour, tone and black-and-white conversion; Deskew straightens tilted pages; Despeckle removes stray dots; Edges removes black borders, punch holes and binding shadows; Orient turns sideways or upside-down pages upright.
The tabs treat your PDF in two very different ways. Deskew and Orient never rasterise anything: they rotate the page's coordinate system, so searchable text and image quality are untouched. Enhance, Despeckle and Edges render each page to pixels, fix the pixels, and replace the page content with that image, which means any existing text layer is gone. A sensible order is orient, deskew, edges and specks, enhance, then OCR.
Enhance: turning yellowed paper white
The tool takes the average colour of the brightest 30% of pixels as the paper colour. On an old document that is usually a yellow with high red and low blue. Each channel is multiplied so that the paper becomes 255 — a white balance — with the gain capped at 2.5× and the reference floored at 96 so a dark scan is not blown out.
Auto levels then clip the darkest 0.5% and brightest 0.5% and stretch the rest to the full range. If the two ends are fewer than 32 levels apart, as on an almost blank page, nothing is stretched; without that guard the paper grain of an empty page would be amplified into black mottling. The brightness and contrast sliders are applied on top of that curve.
Black and white uses Sauvola thresholding
A single threshold for the whole page fails in both directions: text in a shadowed margin fills in, and faint text on a bright area disappears. This tool computes, for each pixel, the mean m and standard deviation s of a surrounding window (about a quarter inch — 51 pixels at 200 DPI) and uses T = m × (1 + k × (s/128 − 1)), the formula Sauvola and Pietikäinen published for document binarisation in 2000. The sensitivity slider is k, 0.25 by default; raising it pushes faint strokes to white.
Flat areas with almost no variation are where the formula tends to amplify noise, so they become paper unless clearly dark. The output is a 1-bit image compressed with lossless Flate, the smallest of the three modes. If pencil notes, photos or coloured stamps matter, use greyscale or colour instead; those are stored as JPEG at quality 80 by default.
Deskew rotates without touching pixels
Each page is rendered at 1400 pixels on the long side, and its dark pixels are projected at many angles; the angle that makes the row histogram spikiest is the one that lines the text up (a projection-profile search). The search sweeps ±15° in 0.5° steps and then refines around the best result at 0.1° and 0.02°. A 1.5% frame is ignored so scanner edges do not dominate.
The correction is applied by prepending a rotation matrix to the page content. Nothing is re-rendered, so text, vector drawings and the original images keep their quality. Annotations and form fields are stored separately and are not rotated with the content; the completion message lists pages where that applies. Turn on “shrink to avoid clipping” if rotated corners would otherwise fall off the page.
Despeckle and Edges pick targets by size and shape
Despeckle treats anything darker than 200 (out of 255) as ink and whitens connected blobs of three pixels or fewer. Raise that limit carefully: at larger sizes, full stops, commas and the dot of an i start to qualify as noise too.
Edges looks for three things separately. Black borders are dark regions connected to the page edge, searched only within 25 mm of it. Punch holes are round blobs 3–12 mm across inside that zone, judged by how close their fill ratio is to a perfect disc (π/4 ≈ 0.785). Binding shadows are found by comparing each column's (or row's) 90th-percentile brightness with the page's paper level and lifting only the darker bands. Borders and holes are painted in the detected paper colour, not pure white.
Orient tries all four directions with OCR
Tesseract has an orientation-detection mode (OSD), but it needs the legacy engine's data, which the LSTM-only build on this site does not include. Instead the page is recognised at 0°, 90°, 180° and 270°, and the direction with the largest sum of character count × confidence (counting words at 55% confidence or more) wins. If the winner is not at least 1.5 times the runner-up, the page is marked uncertain. The fix changes only the page's /Rotate value, so it is lossless. Pages with only drawings or photos give the engine nothing to read and are left alone.
Worked examples
Raw size of a black-and-white A4 page
- Input
A4, 200 DPI, black & white- Output
About 1654×2339 px, about 473 KB before compression
Each row is ceil(1654 ÷ 8) = 207 bytes, and 207 × 2339 = 484,173 bytes. The same page as 8-bit greyscale is about 3.9 MB raw; Flate or JPEG then shrink both considerably.
Shrink-to-fit after a 2° deskew
- Input
Letter or A4 page (595×842 pt for A4), 2° correction, shrink on- Output
Content scaled to about 95.4%
The rotated rectangle is 595 × cos 2° + 842 × sin 2° ≈ 624 pt wide. 595 ÷ 624 ≈ 0.954, the scale that keeps all four corners on the page.
Threshold window size
- Input
Enhance at 300 DPI- Output
Sauvola window of 75 px
The window is a quarter inch (DPI ÷ 4) rounded to an odd number: 300 ÷ 4 = 75. At 200 DPI, 50 becomes 51.
How to use it
- Add the PDF and pick a tab: Enhance, Deskew, Despeckle, Edges or Orient.
- Use the before/after preview to tune sensitivity or size limits.
- Set the page range and resolution, then run.
- If you need search, feed the result to the OCR tool.
Frequently asked questions
Search stopped working after enhancing.
Enhance, Despeckle and Edges rebuild pages as images, which drops the old text layer. Deskew and Orient keep it. Run OCR on the result to make it searchable again.
Thin strokes break up in black and white.
Lower the sensitivity (k) so faint strokes stay black, or raise the resolution to 300 DPI.
A signature field moved after deskewing.
Form fields and annotations are separate from page content and do not rotate with it. Fill and flatten forms before deskewing.
Why wasn't a punch hole removed?
Holes are only detected within 25 mm of an edge, 3–12 mm wide and roughly round. Torn holes or ones touching the edge may be treated as border or missed; try a higher sensitivity.
Related guides
Sources
- Sauvola & Pietikäinen — Adaptive document image binarization (Pattern Recognition 33, 2000)
- Tesseract documentation — Improving the quality of the output (binarisation, skew, borders)
- ISO 32000-1:2008 (PDF 1.7) — page objects, /Rotate, image XObjects
Last reviewed: