# libimagequant

A palette-quantization library that converts RGBA images into palette-based 8-bit indexed images, including the alpha channel, for producing small PNGs and GIFs.

libimagequant converts full RGBA images into palette-based, 8-bit indexed images while preserving the alpha channel, making it well suited to producing small PNG files and good-looking GIFs. It only handles the quantization step; encoding or decoding the actual image file format is left to whatever encoder a caller brings, with the related pngquant command-line tool being one example built on top of it.

Version 4 of the library was rewritten from C into Rust while keeping the same C interface, so existing C programs can keep using it through a Rust crate that exposes that interface, while Rust programs can use the library's own Rust API directly; it can also be cross-compiled to targets such as Android through rustup.

It is dual-licensed: free for open-source software under the GPL version 3 or later, with a separate commercial license available for closed-source or App Store distribution.

Website: https://pngquant.org/lib
