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>
This commit is contained in:
William Vinnicombe 2022-07-06 11:18:34 +01:00 committed by Laurent Pinchart
parent 2778c3298c
commit ed12bb4aba

View file

@ -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()