We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fa649ac + 3495299 commit b3f0d1eCopy full SHA for b3f0d1e
adafruit_imageload/png.py
@@ -112,7 +112,19 @@ def load(
112
for y in range(height):
113
dst = y * scanline
114
src = y * (scanline + 1) + 1
115
- mem[dst : dst + scanline] = data_bytes[src : src + scanline]
+ if depth < 8:
116
+ # Work around the bug in displayio.Bitmap
117
+ # https://github.com/adafruit/circuitpython/issues/6675
118
+ pixels_per_byte = 8 // depth
119
+ for x in range(0, width, pixels_per_byte):
120
+ byte = data_bytes[src]
121
+ for pixel in range(pixels_per_byte):
122
+ bmp[x + pixel, y] = (
123
+ byte >> ((pixels_per_byte - pixel - 1) * depth)
124
+ ) & ((1 << depth) - 1)
125
+ src += 1
126
+ else:
127
+ mem[dst : dst + scanline] = data_bytes[src : src + scanline]
128
return bmp, pal
129
# RGB, RGBA or Grayscale
130
import displayio
0 commit comments