From 09849ce0640985dddfc090544137b26e53ce3ce8 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 27 Oct 2020 14:04:55 +0000 Subject: [PATCH] Explicit JPEG thumbnail on capture --- openflexure_microscope/camera/pi.py | 2 ++ openflexure_microscope/microscope.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/openflexure_microscope/camera/pi.py b/openflexure_microscope/camera/pi.py index 4ea5e691..d49af7e9 100644 --- a/openflexure_microscope/camera/pi.py +++ b/openflexure_microscope/camera/pi.py @@ -484,6 +484,7 @@ class PiCameraStreamer(BaseCamera): use_video_port: bool = False, resize: Tuple[int, int] = None, bayer: bool = True, + thumbnail: tuple = None ): """ Capture a still image to a StreamObject. @@ -515,6 +516,7 @@ class PiCameraStreamer(BaseCamera): resize=resize, bayer=(not use_video_port) and bayer, use_video_port=use_video_port, + thumbnail=thumbnail ) # Set resolution and start stream recording if necessary diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index 824ce971..f68ca1d9 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -384,6 +384,9 @@ class Microscope: ) # Capture to output object + extras = {} + if fmt == "jpeg": + extras["thumbnail"] = (200,150,85) logging.info("Starting microscope capture %s", output.file) self.camera.capture( output, @@ -391,6 +394,7 @@ class Microscope: resize=resize, bayer=bayer, fmt=fmt, + **extras ) output.put_and_save(tags, annotations, full_metadata)