From d40c453dadc2b2f583ea2be04789075be17e8d3f Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Wed, 14 Apr 2021 17:42:37 +0200 Subject: [PATCH] check_dpi: raise exception if resolution == 1 to trigger except clause Co-authored-by: Robert Sachunsky <38561704+bertsky@users.noreply.github.com> --- qurator/eynollah/utils/pil_cv2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qurator/eynollah/utils/pil_cv2.py b/qurator/eynollah/utils/pil_cv2.py index 12c94c9..b10ceb7 100644 --- a/qurator/eynollah/utils/pil_cv2.py +++ b/qurator/eynollah/utils/pil_cv2.py @@ -18,9 +18,10 @@ def check_dpi(image_filename): try: exif = OcrdExif(Image.open(image_filename)) resolution = exif.resolution + if resolution == 1: + raise Exception() if exif.resolutionUnit == 'cm': resolution /= 2.54 return int(resolution) except: return 230 -