Skip to content

Commit 78152bb

Browse files
authored
Merge pull request #35 from jerryneedell/jerryn_buffer
revise calculation of JPEG buffer
2 parents d2b84ed + 36d77ee commit 78152bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_ov5640/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,9 @@ def capture(self, buf: Union[bytearray, memoryview]) -> None:
12361236
def capture_buffer_size(self) -> int:
12371237
"""Return the size of capture buffer to use with current resolution & colorspace settings"""
12381238
if self.colorspace == OV5640_COLOR_JPEG:
1239-
return self.width * self.height // self.quality
1239+
# This is somewhat arbirary but seems to work for a wide range of JPEG images
1240+
# the user can chose to further scale the buffer in the user code if necessary
1241+
return 2 * (self.width * self.height // self.quality)
12401242
if self.colorspace == OV5640_COLOR_GRAYSCALE:
12411243
return self.width * self.height
12421244
return self.width * self.height * 2

0 commit comments

Comments
 (0)