From 519d5f7af9dfdfe9444f2b358703dbdbc1243f78 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 14 Jan 2025 16:25:25 -0600 Subject: [PATCH] move prev,line swap to after putting data into bitmap --- adafruit_imageload/png.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_imageload/png.py b/adafruit_imageload/png.py index 89a9ded..010dff3 100644 --- a/adafruit_imageload/png.py +++ b/adafruit_imageload/png.py @@ -168,7 +168,6 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements src += 1 else: raise ValueError("Wrong filter.") - prev, line = line, prev if mode in (0, 4): # grayscale for x in range(width): c = line[x * unit] @@ -180,5 +179,8 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements ) else: raise ValueError("Unsupported color mode.") + + prev, line = line, prev + pal = displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565) return bmp, pal