Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best quality dithering library in C

I'm developing a texture atlas packer to use with OpenGL, and I'm currently looking for an open-source (it's better if it's a library, but an open-source software would be good as well!) solution that will render the best results for color palette creation / dithering. It really doesn't need to be fast, but needs to achieve optimal results. It would be best if there is a possibility for 4-bit-per-pixel palette generation.

like image 958
Waneck Avatar asked Sep 16 '11 14:09

Waneck


1 Answers

pngquant is available as a pure C library.

ImageMagick uses octtree, which is fast, but not the best quality.

pngquant uses MedianCut with several additional improvements, and is likely to give higher quality.

pngquant has speed/quality trade-off setting which can improve quality a bit further, and also has custom dithering algorithm (variation of Floyd-Steinberg) that doesn't add noise to well-quantized areas of the image.

like image 62
Kornel Avatar answered Oct 01 '22 05:10

Kornel