pil_cv2.check_dpi: fix class membership test

(depending on how the `PIL.Image` was instantiated – file plugin or array interface – the previous `isinstance` could fail, provoking a fall-through to `cv2pil` which does not work)
This commit is contained in:
Robert Sachunsky 2023-06-12 00:45:57 +02:00 committed by GitHub
parent fbe2f2302f
commit 867a7261de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ def pil2cv(img):
def check_dpi(img):
try:
if isinstance(img, Image.__class__):
if isinstance(img, Image.Image):
pil_image = img
elif isinstance(img, str):
pil_image = Image.open(img)