# OCR Coffee Stained Document Pages: Stains and Damage

- Author: Schema Law (https://www.schemalaw.com/)
- Published: 2021-12-24T08:12:23Z
- Updated: 2026-10-11T19:22:20Z
- Category: Difficult scans
- Canonical: https://www.schemalaw.com/blog/ocr-coffee-stained-document

> Can OCR read a coffee stained document? Why stains, highlighter, tape, folds and tears hide text from software, and how a color rescan gets it back.

OCR can often read a coffee stained document where the stain is pale and the print is dark, and it fails where the stain is nearly as dark as the ink. Rescanning the page in color or grayscale usually recovers more than any cleanup of a black and white scan. Proofread the stained area against the paper.

## Can OCR read through a coffee stain?

Yes, OCR can read through a coffee stain when the scan still shows a clear difference between the stain and the letters. It struggles when the page was scanned in black and white, when the stain's dark outer ring crosses a line of text, or when the liquid made the ink itself run.

A coffee stain is not one even patch. Three parts of it behave differently.

**The wash.** The middle of a dried spill is a light tan film. Laser print and photocopier toner show through it plainly. In a grayscale or color scan, text under the wash usually reads about as well as text on clean paper.

**The ring.** As a spill dries, the solids collect at its edge and leave a dark brown outline. The ring is the darkest part of the stain and the narrowest, often about as thick as a pen stroke. Where it crosses a word, it can be taken for part of a letter, or it can blot the letters it touches.

**The ink that moved.** Toner and ballpoint ink do not dissolve in coffee. Fountain pen ink, many felt tips, rubber stamp ink and some inkjet printing do. If the writing has feathered or run, the damage is to the text, not on top of it, and no scan setting restores it.

| What you see on the paper | What to expect from OCR | What to do |
| --- | --- | --- |
| Pale wash over dark laser print | Usually readable in grayscale or color | Scan in color, convert, spot check |
| Dark ring crossing a line | Errors in the words the ring touches | Proofread those words against the paper |
| Stain over small print or a table of figures | Errors likely, and hard to see | Read every figure against the paper |
| Stain over pencil or light pen | Often unreadable to software | Type the passage by hand from the page |
| Ink that has run or feathered | Software and people both struggle | Look for another copy of the page |
| Stain only in a margin | No effect on the text, possible stray characters | Ignore the strays; confirm nothing is missing |

A quick test tells you which row you are in. Hold the page under good light and read the stained words aloud. If you can do it without hesitating, a good scan will give software a fair chance. If you are guessing, software will guess too, and its guess will be printed as neatly as its correct readings.

Stains are one line in a longer inspection. The [triage checklist to run before OCR](https://www.schemalaw.com/blog/ocr-low-quality-pdf#a-triage-checklist-before-you-run-ocr) sorts a whole file by defect, so that a stained page is handled alongside the faxed, tilted and cut-off ones.

## Why does a stain hide text from software but not from your eye?

A stain hides text from software because many recognition pipelines first reduce the page to pure black and white using one brightness cut-off, and a stain sits on the wrong side of that cut-off. Your eye compares each letter with the paper right around it, so a darker patch barely slows you down.

The step has a name, binarization or thresholding. The software looks at how light or dark each pixel is and sorts it into "ink" or "paper". If one cut-off is used for the whole page, it works well when the paper is evenly light and the ink evenly dark.

Put numbers on it. Say brightness runs from 0 for black to 255 for white. On a clean part of the page, paper measures about 235 and print about 50. A cut-off anywhere in the middle, perhaps 140, separates them. Now add a stain.

| Area | Paper brightness | Print brightness | With a single cut-off of 140 |
| --- | --- | --- | --- |
| Clean paper | 235 | 50 | Print is black, paper is white: readable |
| Coffee wash | 170 | 45 | Still separated: readable |
| Coffee ring | 110 | 40 | Ring and print both turn black: letters merge with the ring |
| Wash over pencil | 170 | 150 | Pencil turns white with the paper: the note disappears |

Those figures are made up to show the mechanism, but the pattern is real. The ring becomes a black line that runs through the words. Faint writing inside the stain drops out. And if the software picks a lower cut-off to cope with the stain, pale print elsewhere on the page starts to vanish.

Engine documentation describes the same weakness. The Tesseract project's notes on [improving the quality of the output](https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html) explain that the engine converts an image to black and white internally and that "the result can be suboptimal, particularly if the page background is of uneven darkness". The same page records that version 5 added two further binarization methods, Adaptive Otsu and Sauvola. Methods of that adaptive kind set the cut-off area by area, which is closer to what your eye does. Other engines and newer model-based systems handle uneven backgrounds in their own ways, and some skip a hard black and white step. None of them can use information the scanner never recorded.

That last point is why the scan matters so much. If the scanner itself was set to black and white, it applied its own single cut-off before any software saw the page. The single cut-off has already been applied inside the scanner, and the file contains only the result.

A stain causes two smaller problems as well. Its edge can be read as text, giving you a stray "C", "(" or "J" in the margin. And a large dark blotch can be classed as a picture, in which case the software may skip the whole region, including the words in it. Skipped text is the worse failure, because nothing in the output shows that a paragraph is missing.

## Rescanning a stained page in color or grayscale

Rescan a stained page in color, or in grayscale if color is not available, at 300 dpi or more, with the scanner's automatic text enhancement turned off. Color keeps the stain brown and the print black, so software can tell them apart. Then convert the new scan and proofread the stained area.

This only helps if you hold the paper and the earlier scan was black and white. If the file you were sent is already in color or grayscale, a rescan adds nothing.

1. **Look at the paper first.** Confirm the stain is dry and the page is not stuck to its neighbor. Never put a damp or tacky page on scanner glass or through a feeder.
2. **[Use the flatbed](https://www.schemalaw.com/blog/flatbed-vs-sheet-fed-scanner).** A stained sheet is often cockled, and a feeder can crease or tear it.
3. **Clean the glass.** Dried residue on the glass will appear on every later scan.
4. **Choose color.** Brown on white is a difference in hue as well as in brightness. Grayscale keeps only brightness, which is still far better than black and white.
5. **Switch off "text mode", "background removal" and "auto contrast".** These presets push mid-tones to white or black, which amounts to a single brightness cut-off applied inside the scanner.
6. **Scan at 300 dpi, or 400 dpi if the stained text is small.** More pixels per letter give the software more to work with where contrast is poor.
7. **Check the result at 200% zoom.** Read the stained words on screen. If they are harder to read than on paper, scan again one step lighter or darker and keep the better file.
8. **Keep the earlier scan.** Name the new file so it is clear which is which and when each was made.

### If the first rescan is not enough

Some scanners let you set brightness and contrast by hand. For a dark stain over dark print, a lighter exposure can lift the stain away from the letters. For a stain over faint print, a darker one can strengthen the letters. Make two or three scans at different settings and convert each. One setting may read the stained paragraph and another the rest of the page, and you can take each passage from whichever scan read it correctly, checking both against the paper.

Image editing software can do similar work on a color scan after the fact, by adjusting levels or separating color channels. If you go that way, edit a copy, keep the scan as made, and note what was done. The section on [noise, speckle and coffee stains](https://www.schemalaw.com/blog/ocr-low-quality-pdf#noise-speckle-and-coffee-stains) in the low-quality scan checklist sets out the cautions that apply to cleanup tools in general.

### When there is no paper to rescan

Ask whoever sent the file whether they hold the original or a color scan. If they do not, convert what you have and treat the stained area as unverified until a person has read it against the best image available. Where the trouble is that the whole file is coarse, with too few pixels in every letter, the stain is the lesser problem, and the post on [OCR for a low resolution scan](https://www.schemalaw.com/blog/ocr-low-resolution-scan) deals with that.

Color scans are large. Schema Law takes a PDF, PNG or JPEG of up to 20 MB, so rescan only the stained pages in color if size is a concern. The free plan handles one document a day of up to three pages, which is enough to compare an old black and white scan of a stained page with a new color one. The [pricing page](https://www.schemalaw.com/pricing) has the limits for longer files.

## Highlighter, water damage and ink bleed-through

Highlighter, water marks and bleed-through are discoloration problems like a coffee stain, with the same root cause: something other than the text has changed the brightness of the paper. Each has its own pattern, and color scanning helps with all three.

### Highlighter

Yellow highlighter is nearly harmless in color or grayscale, because yellow is a light color. Pink, green, blue and orange are darker. In a black and white scan or photocopy they can turn into solid black bars across exactly the words someone thought most important. If a black and white copy shows bars, look for the paper or for an earlier color scan. If the highlighting was applied to a photocopy, the copy under it may be all there is.

Highlighting is information too. A converted text file will not show which passages were marked, so keep the color image with the text, and list the highlighted passages if they matter.

### Water damage

Water leaves a tide line much like a coffee ring, usually paler, and it distorts the sheet. Wavy paper does not lie flat on the glass, so parts of the page sit out of focus or in shadow. Press the lid down gently, or lay a clean sheet of card over the page to hold it flat. Do not iron a page or press it hard if it is a record you must preserve.

Water also moves ink. Signatures in fountain pen, inked stamps and inkjet print may be feathered or washed out while the laser-printed body text is untouched. Expect the typed text to convert and the handwriting and stamps to need a person. Stamps that sit on top of print are their own subject, covered in the post on [whether OCR can read stamps over text](https://www.schemalaw.com/blog/can-ocr-read-stamps-over-text).

Pages that dried stuck together should stay together until someone qualified separates them. Scan the faces you can see and note the rest.

### Bleed-through and show-through

Bleed-through is ink that has soaked from one side of the sheet to the other. Show-through is the reverse side visible through thin paper. Both put a faint, mirror-image layer of text behind the text you want. Software may read fragments of it as extra characters, or the clutter may lower the contrast enough to cause errors in the real text.

For show-through, back the page with a sheet of black paper when you scan, which evens out the background. For true bleed-through, where the ink is physically in the paper, color scanning helps most, since the soaked-through ink is usually a different shade from the ink on the front. For ink that has spread and thickened the letters, the Tesseract project's [notes on dilation and erosion](https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html) say: "Heavy ink bleeding from historical documents can be compensated for by using an Erosion technique." Erosion is an image-editing operation that thins the strokes. That is a job for someone comfortable with image software, on a copy.

Yellowed or browned old paper is a whole-page version of the same thing. It lowers contrast evenly, which is easier for software than a patchy stain, and grayscale is normally enough.

## Tape, fold lines, punch holes and torn edges

Physical damage differs from staining in one important way: some of the text may be gone from the paper altogether. Tape and folds mostly obscure text, and a careful scan can recover it. Holes and tears remove it, and the task becomes recording honestly what is missing.

| Damage | What it does to the scan | What OCR tends to do | Handling |
| --- | --- | --- | --- |
| Clear tape over text | Glare from the glossy surface; a visible edge line | Misses words under the glare; reads the tape edge as a rule or as characters | Rescan with the page turned a quarter turn so the light falls differently |
| Old yellowed tape | A brown band, darker than a coffee wash | Loses the words under the band | Scan in color; do not peel the tape |
| Sharp fold or crease | A shadow line; toner flaked off along the fold | Splits a line of text, or drops characters on the crease | Flatten gently under the lid; compare the crease line with the paper |
| Punch holes in the text | Round gaps, black or white depending on the scanner lid | Reads each hole as "O" or "0", and loses the letters punched out | Mark the lost letters as missing in your corrected text |
| Staple holes and rust marks | Small dark specks, often in a corner | Stray punctuation near headers and page numbers | Check page numbers and dates in that corner |
| Torn edge or missing corner | Text ends mid-word | Returns the surviving part with no sign that the rest is gone | Note the loss; look for another copy |
| Folded-over corner | Hides text on the front and shows a triangle of the back | Drops the hidden words; may read the triangle upside down | Unfold before scanning if the paper allows |

A few of these deserve more than a table cell.

**Tape.** The instinct to peel tape off for a cleaner scan is the wrong one. Old adhesive takes the paper surface, and the print, with it. Scan through the tape. Glare is the main enemy, and turning the page on the glass, or closing the lid fully to block room light, often moves the reflection off the words.

**Folds.** A letter that spent years folded in thirds has two horizontal bands where toner has cracked away. Words on those lines are damaged on the paper itself. Software will often return a plausible wrong word there. Read the two fold lines of every page of a folded document, whatever the rest looks like.

**Torn pages.** If the pieces survive, lay them in position on the flatbed, on a sheet of contrasting plain paper, close but not overlapping, and scan them together. Do not tape them first if the document has any evidential importance. Then scan each fragment by itself as well, so that no text is hidden in the join.

**Holes.** A two-hole punch at the top of a page often goes through the caption, the date or the page number. Those are short, important items with no surrounding sentence to help a reader guess. Check them on every punched page.

Where text is physically gone, say so in the converted file with a bracketed note at the gap, such as "[hole]" or "[torn, about four words missing]". The reader of the text needs to know the gap exists and how large it is.

## Handling a damaged original that is also evidence

When a damaged original is also evidence, do not clean, flatten, repair or separate it. Record its condition, scan it as it is, and do all your reading and cleanup on copies. The stain or tear may itself matter, and treatment that improves legibility can destroy what a later examiner needs.

Start by telling the lawyer responsible for the matter what you have found. What must be preserved, and how, is a legal question that depends on the case and the jurisdiction. What follows is document handling, not legal advice.

Say what the page is. A stained affidavit still needs an authentication note: who had it, and the chain of custody from the envelope to your scan. You record the stain's place relative to the signature. Spoliation questions, and any fight under the best evidence rule, belong to the lawyer. Your note just shows the condition you saw.

The paper keeps its importance even after a good scan exists. In federal courts, [Rule 1002 of the Federal Rules of Evidence](https://www.law.cornell.edu/rules/fre/rule_1002) starts from the position that an original writing is required to prove its content unless the rules or a federal statute provide otherwise. [Rule 1003 on the admissibility of duplicates](https://www.law.cornell.edu/rules/fre/rule_1003) then makes a duplicate admissible to the same extent as the original, "unless a genuine question is raised about the original's authenticity or the circumstances make it unfair to admit the duplicate." A damaged original is exactly the kind of document about which such questions get asked, so the paper should be there to answer them. State courts and tribunals have their own rules, and they differ.

A handling routine for the damaged page:

1. **Photograph it as received.** Take a color photo of each side before anything else, with any envelope or folder it came in. Include a ruler or a sheet of standard paper for scale if the damage is unusual.
2. **Note the condition in writing.** Record who received it, when, from whom, and what the damage looks like: "brown stain, lower right quarter, covers signature block; clear tape across the tear on page 2".
3. **Scan it once, carefully, on the flatbed.** Color, 300 dpi or higher, no enhancement, both sides. This is the record scan. Do not alter it.
4. **Work from copies.** Rescans at other exposures, cropped or brightened images and converted text are working copies. Name them that way.
5. **Leave repairs alone.** Do not add tape, glue or staples, and do not remove the ones already there. The Library of Congress guidance on the [care, handling and storage of works on paper](https://www.loc.gov/preservation/care/paper.html) lists rubber bands, self-adhesive tape and glue among the things not to use on paper, and says that condition problems beyond basic care may need treatment by a paper conservator.
6. **Store it flat and apart.** Put the page in its own folder, unfolded only as far as it opens without force, away from heat, damp and direct light.
7. **Keep handling to a minimum.** Clean, dry hands, a clean desk, and no drinks nearby. Each person who handles the page should be noted if the matter calls for a custody record.

Then deal with the text. Convert the record scan, proofread the damaged areas against the paper, and mark what cannot be read. The converted text of a damaged page should carry a note at the top saying which passages were stained, torn or taped and how they were read. The post on low-quality scans describes a log for [recording what could not be read](https://www.schemalaw.com/blog/ocr-low-quality-pdf#recording-what-could-not-be-read), and a damaged exhibit is the case it was made for.

One last check before the paper goes back into its folder. Ask whether the damage has a story. A stain that covers one signature and not the one beside it, a tear along a line of text, or tape that looks newer than the page are observations worth passing to the lawyer on the matter, described plainly and without conclusions. A scan flattens those clues, and converted text carries none of them, so the person looking at the paper is the one who can see them.

## Try it on a real document

Upload a scanned PDF and export it as Word, a searchable PDF or plain text on the free plan. Your documents are never used to train an AI model. [Start free](https://www.schemalaw.com/api/auth/google)
