[libcamera-devel] [PATCH 1/3] utils: raspberrypi: ctt: load_image: Ignore JPEG files with no raw data

David Plowman david.plowman at raspberrypi.com
Wed Jul 6 12:18:34 CEST 2022


From: William Vinnicombe <william.vinnicombe at raspberrypi.com>

The load_image function would throw errors with JPEG or JPG files containing
no raw data.

Prevent throwing these errors by returning 0 if an error has occurred.

Signed-off-by: William Vinnicombe <william.vinnicombe at raspberrypi.com>
---
 utils/raspberrypi/ctt/ctt_image_load.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utils/raspberrypi/ctt/ctt_image_load.py b/utils/raspberrypi/ctt/ctt_image_load.py
index 66adb237..934db123 100644
--- a/utils/raspberrypi/ctt/ctt_image_load.py
+++ b/utils/raspberrypi/ctt/ctt_image_load.py
@@ -358,6 +358,11 @@ def load_image(Cam, im_str, mac_config=None, show=False, mac=True, show_meta=Fal
             Img = dng_load_image(Cam, im_str)
         else:
             Img = brcm_load_image(Cam, im_str)
+        """
+        handle errors smoothly if loading image failed
+        """
+        if Img == 0:
+            return 0
         if show_meta:
             Img.print_meta()
 
-- 
2.30.2



More information about the libcamera-devel mailing list