mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-08 19:59:56 +02:00
check_dpi: catch Pillow choking on faulty img, return 230
This commit is contained in:
parent
ff265eee5c
commit
6c8852eb04
1 changed files with 6 additions and 6 deletions
|
@ -15,13 +15,13 @@ def pil2cv(img):
|
|||
return cvtColor(pil_as_np_array, color_conversion)
|
||||
|
||||
def check_dpi(img):
|
||||
if isinstance(img, Image.__class__):
|
||||
pil_image = img
|
||||
elif isinstance(img, str):
|
||||
pil_image = Image.open(img)
|
||||
else:
|
||||
pil_image = cv2pil(img)
|
||||
try:
|
||||
if isinstance(img, Image.__class__):
|
||||
pil_image = img
|
||||
elif isinstance(img, str):
|
||||
pil_image = Image.open(img)
|
||||
else:
|
||||
pil_image = cv2pil(img)
|
||||
exif = OcrdExif(pil_image)
|
||||
resolution = exif.resolution
|
||||
if resolution == 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue