Straighten and clean a scanned PDF

A page fed slightly crooked stays crooked in every copy anyone makes of it afterwards. Dust on the scanner glass becomes dust in the document. Neither is hard to fix, and both make everything downstream — reading it, recognising it, printing it — noticeably worse.

or drop a file anywhere on this panel

opened locally · 0 bytes sent

How it works

  1. 01Open the scanned PDF.
  2. 02Choose what to fix: straighten, de-speckle, brighten.
  3. 03Cleaning runs page by page and the panel reports what it found.
  4. 04Export.

It refuses most pages, on purpose

Cleaning works on pixels, so a cleaned page comes back as an image. Doing that to a page of real text would destroy its selectable text, its searchability and its accessibility in exchange for removing dust that was never there. So only pages that are already a single scanned image with no text of their own are touched, and the panel says how many pages it is leaving alone and why.

Straightening measures, it does not guess

The skew is found by testing how sharply the ink lines up into rows at each angle — a page of text has sharp rows when it is straight and smeared ones when it is not. It reads the whole page rather than hunting for a feature, so it works on dense text, sparse text and forms alike. A page that is already straight is reported as straight and left alone: rotating it would resample every pixel and cost a little sharpness for nothing.

De-speckling removes specks and nothing else

Most tools de-speckle with a blur filter, which removes dust by softening everything — rounding the corners off every letter and thinning hairlines. This finds the connected blobs of ink that are smaller than a speck should be and erases exactly those. Text is untouched, measurably: there is a test that fails if the ink on a page of text changes at all.

Brightening adapts to the page

A grey photocopy has no true black and no true white, so it is stretched back to full range. The stretch ignores a fraction of a percent at each end, because otherwise one dust speck at pure black and one blown highlight define the whole scale and the page barely changes — which is what a naive version does.

Clean first, then recognise

Text recognition reads a straightened, de-speckled page substantially better than a crooked, speckled one — and it reads speckles as punctuation. If you plan to make a scan searchable, doing it in that order is the single biggest thing you can do for the result.

Questions

Will the cleaned page still be searchable?
Only if it already was, which for a plain scan means it was not. A cleaned page is an image; run Make searchable afterwards to add the text back.
Why did it say none of my pages are scans?
Because they contain real text or drawings. That is good news — those pages are already better than a scan, and cleaning would make them worse.
Can I make it remove bigger marks?
Yes, up to about twenty-four pixels. Be careful past a certain point: full stops, the dots on i's and accents are all small marks too, and a large setting will start removing them.
Will the file get bigger or smaller?
Usually smaller — the cleaned page is re-encoded as a JPEG at two hundred dots per inch, which is often less than the original scan. It is not a compression tool though; use Compress for that.