summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Vinnicombe <william.vinnicombe@raspberrypi.com>2022-07-06 11:18:34 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-06 21:33:35 +0300
commited12bb4abaca50240178a5123f35dd01de8f484e (patch)
treedc04d11119d384381c0622e229d40a874cdc8a00
parent2778c3298ca421e2ec670c10d8bab7beaa78f5e9 (diff)
utils: raspberrypi: ctt: load_image: Ignore JPEG files with no raw data
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@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--utils/raspberrypi/ctt/ctt_image_load.py5
1 files changed, 5 insertions, 0 deletions
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()