]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: Add a warning about a low image DPI which may cause OCR to fail (#4708)
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Wed, 29 Nov 2023 19:28:27 +0000 (11:28 -0800)
committerGitHub <noreply@github.com>
Wed, 29 Nov 2023 19:28:27 +0000 (11:28 -0800)
src/paperless_tesseract/parsers.py

index f64ea8adf11f7040b1faa8e79c07efc7549ab9bc..3523da7bde4a482abad0f76aaa03f1d664e2ea63 100644 (file)
@@ -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: