check_dpi: raise exception if resolution == 1 to trigger except clause

Co-authored-by: Robert Sachunsky <38561704+bertsky@users.noreply.github.com>
This commit is contained in:
Konstantin Baierer 2021-04-14 17:42:37 +02:00 committed by GitHub
parent 1367f82605
commit d40c453dad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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