]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Tweaks the resizing based on testing
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Thu, 19 Jan 2023 16:19:21 +0000 (08:19 -0800)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Tue, 24 Jan 2023 18:30:53 +0000 (10:30 -0800)
src/documents/barcodes.py

index 597f228f36a55d69a50c7bf78a83c8d4d3aa816a..82b8afecc99fd529e342470594a2532883ffdb9d 100644 (file)
@@ -177,16 +177,15 @@ def scan_file_for_barcodes(
                     # See: https://github.com/paperless-ngx/paperless-ngx/issues/2385
                     # TLDR: zbar has issues with larger images
                     width, height = pillow_img.size
-                    if width > 512:
-                        scaler = ceil(width / 512)
+                    if width > 1024:
+                        scaler = ceil(width / 1024)
                         new_width = int(width / scaler)
                         new_height = int(height / scaler)
                         pillow_img = pillow_img.resize((new_width, new_height))
 
                     width, height = pillow_img.size
-
-                    if height > 1024:
-                        scaler = ceil(height / 1024)
+                    if height > 2048:
+                        scaler = ceil(height / 2048)
                         new_width = int(width / scaler)
                         new_height = int(height / scaler)
                         pillow_img = pillow_img.resize((new_width, new_height))