By: Julia on EPH
Re-posted from: https://ericphanson.com/blog/2025/libimagequant.jl/
This post is cross-posted from the Julia language community’s
Discourse forum. See here
for the original post where you can read and leave comments.
libimagequant is
a GPL Rust library (originally C, ported to rust by the maintainers)
which performs color quantization (available from the command line as pngquant). I got it building with
Binary Builder and wrote a small Julia wrapper called LibImageQuant.jl
to make it easier (and slightly more efficient) to use from Julia.
Instead of saving a PNG to disk and then calling pngquant,
you can do it in-memory with
quantize_image(figure_or_matrix).