inky
inky copied to clipboard
CI: Rewrite set_image for Spectra 6 to handle more edge cases
We've had various problems with the image remapping code (particularly where P mode images have more than six colours), most of which was very, very old code I wrote back when I had much less idea what I was doing.
This rewrite should fix all cases by avoiding as much special casing as possible. The one exception is where a P mode image has no palette at all, and thus no colour information. For example the Hello World example uses palette indexes but never creates a palette (image.palette.colors == {}) so attempting to quantize it has very bizarre results.
- [x] Test for https://github.com/pimoroni/inky/issues/227
- [x] Test https://github.com/pimoroni/inky/pull/221 fixes this case (it does not)
- [x] Test https://github.com/pimoroni/inky/pull/221 looks good! (N/A)
- [x] New goal: Rewrite set_image
I have tested it and now the pre-dithered image is left alone.