OCRmyPDF’s manual says –tesseract-thresholding sets Tesseract 5.0+ input image thresholding: auto, otsu, adaptive-otsu or sauvola, and that it may improve OCR on low quality images or those with high contrast colour.
Use the practice file
A practice document, practice-threshold.pdf. The file is fictional.
| Page | Content |
|---|---|
| 1 | Low-contrast scan, grey text on grey paper, 10 lines, including the word “harvest” |
| 2 | High-contrast colour scan, 8 lines |
| 3 | Notes page |
Page 1 is the check page: the word “harvest” appears there once, in low-contrast grey text.
Check thresholding
Expected result. We checked the OCRmyPDF manual and the Tesseract manual. We did not run any tool. The checks below are what to expect if the work is done correctly; run them yourself on the practice file.
1. Run with the default thresholding
Run ocrmypdf practice-threshold.pdf out1.pdf and copy page 1.
Expected result: Count the misread words on the low-contrast page.
2. Run with adaptive-otsu
Run ocrmypdf –tesseract-thresholding adaptive-otsu practice-threshold.pdf out2.pdf and copy page 1.
Expected result: Count the errors again.
3. Run with sauvola
Run ocrmypdf –tesseract-thresholding sauvola practice-threshold.pdf out3.pdf and copy page 1.
Expected result: Count the errors a third time.
4. Pick the best for this scan
Compare the three counts.
Expected result: The mode with the fewest errors on page 1 is the one to use.
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Run with the default thresholding | Count the misread words on the low-contrast page. | — |
| Run with adaptive-otsu | Count the errors again. | — |
| Run with sauvola | Count the errors a third time. | — |
| Pick the best for this scan | The mode with the fewest errors on page 1 is the one to use. | — |
Related guides: How to Batch OCR a Multi-Page PDF with Consistent Settings — How to Add a Searchable Text Layer to a Scanned PDF.
Limits
- Thresholding decides what counts as ink and what counts as paper: the wrong choice erases faint text or invents text from stains, so compare counts, not feelings.
- Command-line OCR rewrites the file, so always work on a copy and keep the original scan untouched.
- UNTESTED — no OCR tool was run; all results above are expected results. The practice file is fictional.
Sources
- OCRmyPDF manual, “ocrmypdf(1) — add an OCR text layer to scanned PDF files” — Modes default, force, skip, redo and strip; –sidecar writes the recognized text; –pages limits OCR to chosen pages. Checked 2026-11-28.
- Tesseract manual, “tesseract(1) — command-line OCR engine” — Default language is English; -l takes 3-character ISO 639-2 codes, joined with + for several languages; –list-langs lists installed packs; –psm sets the page segmentation mode. Checked 2026-11-28.
