Skip to content

Conversation

Gadgetoid
Copy link
Member

@Gadgetoid Gadgetoid commented Jun 16, 2025

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.

  1. Test for IndexError - index 254 out of bounds for axis 0 with size 6 #227
  2. Test fix color-remapping for images that are already in platte mode #221 fixes this case (it does not)
  3. Test fix color-remapping for images that are already in platte mode #221 looks good! (N/A)
  4. New goal: Rewrite set_image

@Gadgetoid Gadgetoid force-pushed the patch-e673-256-color branch from f9e8939 to f8b7ef4 Compare June 16, 2025 09:18
@Gadgetoid Gadgetoid force-pushed the patch-e673-256-color branch from f8b7ef4 to 40e145a Compare June 16, 2025 09:31
@Gadgetoid Gadgetoid changed the title CI: Fix fox out of range colours on Spectra 6 palette-mode images CI: Rewrite set_image for Spectra 6 to handle more edge cases Jun 16, 2025
@bablokb
Copy link

bablokb commented Jun 17, 2025

I have tested it and now the pre-dithered image is left alone.

@Gadgetoid Gadgetoid merged commit 6f04624 into main Jul 3, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants