From 867a7261de27bec7efc7e7add80f10ae18bc419a Mon Sep 17 00:00:00 2001 From: Robert Sachunsky <38561704+bertsky@users.noreply.github.com> Date: Mon, 12 Jun 2023 00:45:57 +0200 Subject: [PATCH] pil_cv2.check_dpi: fix class membership test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (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) --- qurator/eynollah/utils/pil_cv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qurator/eynollah/utils/pil_cv2.py b/qurator/eynollah/utils/pil_cv2.py index 20dc22f..83ae47d 100644 --- a/qurator/eynollah/utils/pil_cv2.py +++ b/qurator/eynollah/utils/pil_cv2.py @@ -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)