File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
PiCowbell_Camera_Demos/JPEG_Capture Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,10 @@ def open_next_image():
7878cam .colorspace = adafruit_ov5640 .OV5640_COLOR_JPEG
7979
8080# Different platforms have different amounts of memory available.
81- # Typically a Pico 2 can handle quality = 2 and a Pico can handle quality = 5.
82- # Rather than detect and select sizes, let's try to detect the best dynamically
83- # for broader platform support.
84- # Start with the highest quality setting and attempt to allocate a buffer
81+ # Typically a Pico 2 can handle quality = 2 and a Pico can handle quality = 5.
82+ # Rather than detect and select sizes, let's try to detect the best dynamically
83+ # for broader platform support.
84+ # Start with the highest quality setting and attempt to allocate a buffer
8585# of the necessary size. If it fails, try the next lowest.
8686b = None
8787for quality in range (2 ,55 ): #valid range is 2 to 54 inclusive
@@ -91,12 +91,12 @@ def open_next_image():
9191 b = bytearray (cam .capture_buffer_size )
9292 print (f"Quality { quality } successfully selected." )
9393 break
94- except Exception :
94+ except MemoryError :
9595 print (f"Quality { quality } was too big. Trying next lowest." )
9696
9797if b is None :
9898 print ("There wasn't enough system memory to allocate the lowest quality buffer." )
99-
99+
100100jpeg = cam .capture (b )
101101
102102while True :
You can’t perform that action at this time.
0 commit comments