News for hackers. Stuff that matters.
Re:Show HN: An attempt to make a reduce-palette/dither filte... by dubiousconst281 on Saturday August 20, 2022 @01:31PM (#32533729)
One fast way to do palette reduction is by using a 16-bit RGB565 lookup table filled with all the closest colors relative to each entry index, then you can replace each pixel in the image using just a few bitwise ops and one array access.
Re:Show HN: An attempt to make a reduce-palette/dither filte... by rikroots on Saturday August 20, 2022 @02:11PM (#32534023)
That's an interesting approach!

I went a different way, converting each pixel to its LAB color space values to find the optimal palette for the image (based on preference arguments), then afterwards measuring each pixel against the palette colors to find the two closest colors before deciding which of those two colors to pick based on a distance propensity weighting against the semi-random number assigned to that pixel.

Coming up with highly efficient algorithms (for anything!) is not my strongest skill. Neither is trying to explain them.