← All posts

How to Redact a Scanned Document or Photo

· 5 min read

Most guides to redacting a PDF quietly assume your document has selectable text. Plenty don't. A contract that came back from the other side as a scan, a medical record faxed from a clinic, a passport photographed on a desk, a form someone printed, signed, and put through a copier — these are images of documents, not documents, and they break most redaction workflows in a way that isn't obvious until it's too late.

Here's why, and what to do about it. If you want the shorter argument first, read why a black box isn't redaction.

Why scans are different

A digital PDF stores text as text: place these characters, in this font, here. Redacting it means finding those instructions and deleting them.

A scanned page stores no text at all. It stores a picture. The characters you can read are just dark pixels arranged in shapes your eye interprets as letters. There is nothing to search, nothing to select, and nothing to delete.

This has two consequences, and the second one is the dangerous one.

First, "find and redact" tools find nothing. Search the document for a Social Security number and you get no matches — not because it isn't there, but because the tool can't read the page. Some tools will tell you they found nothing. Some will just hand the file back looking untouched.

Second, and worse: a tool can appear to succeed. If the software draws a black rectangle over the region you selected, the page looks redacted. But drawing a shape on top of an image doesn't alter the image underneath any more than it alters text. Remove the annotation layer and the original scan is intact.

What actually has to happen

To redact a scanned page properly, three things must occur in order:

  1. Something must read the page. Optical character recognition (OCR) converts the pixels into text and, critically, records where on the page each word physically sits.
  2. The sensitive words must be located in that OCR output — by pattern (Social Security numbers, card numbers, emails) or by matching names you supply.
  3. Those pixels must be destroyed. Not covered — overwritten in the image data itself, with the original image discarded, so the page you download is built from pixels that never contained the information.

Skip step three and you have a black rectangle. Skip step one and you have nothing at all.

OCR quality is the whole ballgame

Here's the part that gets underestimated: on a scanned document, your redaction is only as good as your OCR. If OCR can't read a number, nothing downstream can remove it — and the failure is silent. There's no error. The page simply comes back with one fewer black bar than it should have, and nothing draws your attention to it.

We measured this on a real passport photographed at an angle on a desk — rotated, slightly skewed, small print over a patterned security background. Nothing exotic; this is what a phone photo of a document looks like.

A widely used open-source OCR engine read zero words from that page. Not a handful of mistakes — nothing at all. A tool built on it would have returned that passport completely untouched while reporting success.

A commercial OCR service read 117 words from the identical image, corrected the rotation on its own, coped with the background pattern, and located the name and date of birth precisely enough to remove them.

That's the difference between a redacted passport and a disclosed one, on the same input, from the same photo.

This matters most for scanned medical records and public-records releases, which are overwhelmingly image-based.

The trap: pages that are both

There's a failure mode specific to real-world documents that even careful tools miss.

Plenty of pages aren't purely one thing. A bank statement has selectable text and a scanned remittance slip at the bottom. A signed contract has a text body and a photographed ID attached. An invoice has text and a stamp.

A tool that decides "is this page text, or is it a scan?" and picks one path will send these pages down the text route — reasonably enough, since they do have text. It will redact the text layer flawlessly. And it will never look at the image at all.

The result passes every casual inspection. The text-layer data really is gone. And the account number inside the embedded image is still sitting there, perfectly readable, in a file you've been told is clean.

The fix is to check embedded images on every page regardless of what else is on it. It costs more — each image needs OCR — but "we assumed that page was fine" is not a defence you want to make later.

How to check your own output

Whatever tool you use, verify it. For scanned pages the test is refreshingly concrete:

  1. Open the redacted PDF and look at it. Are the black areas actually opaque, or can you see faint text through them?
  2. Export the page as an image, or screenshot it, and zoom in on the redacted regions. If characters are legible, the pixels were never destroyed.
  3. Extract the embedded images if you can — many PDF tools will let you save images out of a file. What you get should already be blacked out. If the image you extract is the original, the black bar was only ever drawn on top.
  4. Run it through OCR again. If a text-extraction tool can still read the sensitive values, so can anyone else.

Test four is the one we build into our own test suite, because it's the closest thing to how a determined person would actually attack the file.

What no tool can do for you

Two honest limits, whichever product you choose.

Handwriting won't be detected. OCR reads print. A signature, an initial in a margin, a handwritten date — none of these will be found automatically. If they need to go, mark them yourself.

Badly degraded scans reduce accuracy. A heavily compressed fax, a third-generation photocopy, a dim phone photo — these cost OCR recall no matter how good the engine. Better OCR helps enormously; nothing gets you to a guarantee.

Which is why, for anything that matters, you look at the output before you send it. The point of good tooling isn't that it removes the need to check. It's that when it does remove something, the thing is actually gone.

You can try this yourself on a scanned page, free.

The short version

Scanned documents need OCR to locate text, and pixel destruction to remove it. Anything less is a rectangle. Check the result by extracting the image and reading it — and remember that a page with text on it can still be hiding a scan.

Try it on a document you've already redacted

Select the page, copy it, and paste it into a text editor. If the text is still there, it was never removed.