optimize: skip images with unusually small dimensions

They're unlikely to be handled well by our recompressors. It seems
that JBIG2 cannot handle very small widths.

Fixes #732
This commit is contained in:
James R. Barlow
2021-02-14 01:43:25 -08:00
parent 2898879be7
commit 2a52c6dec2
+3
View File
@@ -76,6 +76,9 @@ def extract_image_filter(
if image.Length < 100:
log.debug(f"Skipping small image, xref {xref}")
return None
if image.Width < 8 or image.Height < 8: # Issue 732
log.debug(f"Skipping oddly sized image, xref {xref}")
return None
pim = PdfImage(image)