Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: Add a warning about a low image DPI which may cause OCR to fail (#4708)

Trenton He1b573adeb3f
diff --git a/src/paperless_tesseract/parsers.py b/src/paperless_tesseract/parsers.py
index f64ea8adf..3523da7bd 100644
--- a/src/paperless_tesseract/parsers.py
+++ b/src/paperless_tesseract/parsers.py
@@ -244,6 +244,10 @@ class RasterisedDocumentParser(DocumentParser):
f"no DPI information is present in this image and "
f"OCR_IMAGE_DPI is not set.",
)
+ if ocrmypdf_args["image_dpi"] < 70: # pragma: no cover
+ self.log.warning(
+ f"Image DPI of {ocrmypdf_args['image_dpi']} is low, OCR may fail",
+ )
if settings.OCR_USER_ARGS and not safe_fallback:
try: