OCRmyPDF’s manual says –oversample enlarges images to at least the given DPI to improve OCR results slightly. It is a small help for a low-resolution scan, not a repair: the pixels it adds are interpolated, not real detail.
Use the practice file
A practice document, practice-low-dpi.pdf. The file is fictional.
| Page | Content |
|---|---|
| 1 | Low-resolution scan, 150 dpi, 10 lines, including the word “harvest” |
| 2 | Same content rescanned at 300 dpi, for comparison |
| 3 | Notes page |
Page 1 is the check page: the word “harvest” appears there once, at 150 dpi.
Check oversampling
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 OCR without oversampling
Run ocrmypdf practice-low-dpi.pdf out1.pdf and copy page 1.
Expected result: Count the misread words on page 1.
2. Run OCR with –oversample 300
Run ocrmypdf –oversample 300 practice-low-dpi.pdf out2.pdf and copy page 1.
Expected result: Count the misread words again.
3. Compare the counts
Put the two error counts side by side.
Expected result: The oversampled run has the same or slightly fewer errors; it does not match the 300 dpi rescan.
4. Search for the key word
Use Find for “harvest” in out2.pdf.
Expected result: 1 hit, on page 1.
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Run OCR without oversampling | Count the misread words on page 1. | — |
| Run OCR with –oversample 300 | Count the misread words again. | — |
| Compare the counts | The oversampled run has the same or slightly fewer errors; it does not match the 300 dpi rescan. | — |
| Search for the key word | 1 hit, on page 1. | — |
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
- Oversampling can only work with the pixels that exist; if the errors stay, the fix is a better scan, not a bigger number.
- 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.
