|
|
|
|
|
by dubiousconst281
1404 days ago
|
|
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. |
|
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.