adafruit / Adafruit_CircuitPython_BitmapSaver

Save displayio bitmaps to BMP disk
MIT License
5 stars 9 forks source link

Issues saving a displayio.Bitmap #21

Closed caternuson closed 2 years ago

caternuson commented 2 years ago

I think this was introduced with #14. Just run library example to demonstrate:

Adafruit CircuitPython 7.1.1 on 2022-01-14; Adafruit PyPortal with samd51j20
>>> import bitmapsaver_simpletest
Setting up SD card
Building sample bitmap and palette
Saving bitmap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bitmapsaver_simpletest.py", line 54, in <module>
  File "adafruit_bitmapsaver.py", line 142, in save_pixels
  File "adafruit_bitmapsaver.py", line 140, in save_pixels
  File "adafruit_bitmapsaver.py", line 102, in _write_pixels
NameError: local variable referenced before assignment
>>>  

If a bitmap is passed in, result_buffer is not used, but the resetting of result_buffer is happening outside that logic.