From ed12bb4abaca50240178a5123f35dd01de8f484e Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Wed, 6 Jul 2022 11:18:34 +0100 Subject: 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 Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- utils/raspberrypi/ctt/ctt_image_load.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'utils/raspberrypi') 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() -- cgit v1.2.1