by mattdesl · 1y ago · 0 comments
The other issue with your code right now, is that it is using euclidean distance in RGB space to choose the nearest color, but it would be probably also more accurate to use a perceptual color difference metric, a very simple choice is euclidean distance on OKLab colors.
I think dithering is a pretty interesting area of exploration, especially as a lot of the popular dithering algorithms are quite old and optimized for ancient compute requirements. It would be nice to see some dithering that isn't using 8-bits for errors, is based on perceptual accuracy, and perhaps uses something like a neural net to diffuse things in the best way possible.
[1]: https://juliagraphics.github.io/Colors.jl/stable/colordiffer...
[2]: https://github.com/JuliaImages/DitherPunk.jl
[3]: https://juliaimages.org/DitherPunk.jl/stable/#Dithering-with...
If anyone's curious I've implemented this here: https://github.com/DDoS/Cadre/blob/main/encre/core/src/dithe... I use it to map images from their source colour space to the lower gamut palettes of E Ink colour displays.
No textures or masks, just brute computing on the CPU.
I’ll try OKLab and compare, thanks for the comment :)