#22 explicitly set bytearray size
This commit is contained in:
@@ -36,10 +36,12 @@ class PiCam1(PiCam):
|
|||||||
|
|
||||||
def capture(self, preview: bool = False) -> bytearray:
|
def capture(self, preview: bool = False) -> bytearray:
|
||||||
# Bytes to hold output buffer
|
# Bytes to hold output buffer
|
||||||
out = bytearray()
|
|
||||||
bytes_stream = BytesIO()
|
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
|
# If preview we'll already have the right resolution
|
||||||
self.set_camera_resolution(self.capture_resolution)
|
self.set_camera_resolution(self.capture_resolution)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user