OCR & Container Tuning
Halving OCR CPU & RAM With Skip Mode and Safe Image Caps
Configure PAPERLESS_OCR_MODE=skip and PAPERLESS_OCR_IMAGE_DPI=300 to avoid burning RAM on born-digital PDFs and giant flatbed scans.
45-65% Lower Batch OCR Time · Zero Giant-TIFF OOMs
Protecting Workers From 1,200-DPI Accidental Scans
A single misconfigured flatbed scan at 1,200 DPI expands into a multi-gigabyte raw bitmap inside Tesseract and Ghostscript, killing an entire Celery worker. Capping PAPERLESS_OCR_IMAGE_DPI=300 and setting max image pixels eliminates surprise spikes.
Preserving Native Vector Text
Keeping PAPERLESS_OCR_MODE=skip preserves crisp selectable fonts on utility bills and bank statements while reserving full Tesseract compute for paper scans.
Measured Thresholds & Container Limits
| Env Flag | Recommended Setting | Why It Matters |
|---|---|---|
| PAPERLESS_OCR_MODE | skip (default) or redo | Skips Tesseract on native-text PDFs |
| PAPERLESS_OCR_IMAGE_DPI | 300 | Prevents 600-1200 DPI scans from exploding RAM |
| PAPERLESS_OCR_MAX_IMAGE_PIXELS | 120000000 | Guards Ghostscript against malformed TIFFs |
| PAPERLESS_OCR_CLEAN | clean | Removes scanner speckle before text extraction |