#22 explicitly set bytearray size

This commit is contained in:
James Hodgson
2022-10-07 14:53:08 +01:00
parent 09c13f4fcc
commit a165ce946f

View File

@@ -36,10 +36,12 @@ class PiCam1(PiCam):
def capture(self, preview: bool = False) -> bytearray:
# Bytes to hold output buffer
out = bytearray()
bytes_stream = BytesIO()
if not preview:
if preview:
out = bytearray(self.preview_resolution[0] * self.preview_resolution[1])
else:
out = bytearray(self.capture_resolution[0] * self.capture_resolution[1])
# If preview we'll already have the right resolution
self.set_camera_resolution(self.capture_resolution)