From 8d0f85294afc4b3071685a7fde7c8cff9514487c Mon Sep 17 00:00:00 2001 From: terrtia Date: Wed, 2 Oct 2024 15:30:29 +0200 Subject: [PATCH] fix: [qrcode extractor] fix invalid jpeg --- bin/modules/QrCodeReader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/modules/QrCodeReader.py b/bin/modules/QrCodeReader.py index bc7222d9..642cc93e 100755 --- a/bin/modules/QrCodeReader.py +++ b/bin/modules/QrCodeReader.py @@ -51,7 +51,11 @@ class QrCodeReader(AbstractModule): def extract_qrcode(self, path): qr_codes = False contents = [] - image = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB) + try: + image = cv2.cvtColor(cv2.imread(path), cv2.COLOR_BGR2RGB) + except cv2.error: + image = cv2.imread(path) + try: decodeds = decode(image) for decoded in decodeds: