Skip to content

Commit 1ef11c4

Browse files
Timeout in capture_array, capture_highres_array added
1 parent c99b356 commit 1ef11c4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/labthings_picamera2/thing.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,9 @@ def capture_jpeg(
737737
logging.info("Reconfiguring camera for full resolution capture")
738738
cam.configure(cam.create_still_configuration())
739739
cam.start()
740+
cam.options["quality"] = 95
740741
logging.info("capturing")
741-
cam.capture_file(path, name="main", format="jpeg")
742+
cam.capture_file(path, name="main", format="jpeg", wait=5)
742743
logging.info("done")
743744
# After the file is written, add metadata about the current Things
744745
exif_dict = piexif.load(path)
@@ -773,6 +774,15 @@ def grab_jpeg(
773774
)
774775
return JPEGBlob.from_bytes(frame)
775776

777+
@thing_action
778+
def capture_highres_array(
779+
self,
780+
):
781+
with self.picamera(pause_stream=True) as picam2:
782+
capture_config = picam2.create_still_configuration()
783+
array = picam2.switch_mode_and_capture_array(capture_config)
784+
return array
785+
776786
@thing_action
777787
def grab_jpeg_size(
778788
self,

0 commit comments

Comments
 (0)