5

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.

Waneck
  • 2,450
  • 1
  • 19
  • 31
  • I have provided code for Floyd-Steinberg dithering here: http://stackoverflow.com/a/17900812/342646 – RawMean Jul 27 '13 at 18:00

3 Answers3

4

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.

Kornel
  • 97,764
  • 37
  • 219
  • 309
3

Imagemagick is a very powerful C library for graphical manipulation: http://www.imagemagick.org/ It has commandline tools, but can also be used as a C library.

Gabriel Ross
  • 5,168
  • 1
  • 28
  • 30
  • Thank you! That will do. One question though, as I really need not the one with most features, but the one with the best dithering algorithm, do you know if their dithering algorithm is any good? – Waneck Sep 19 '11 at 10:09
2

For future reference, I found PNGNQ, which is a pretty good library for image quantization. Their samples are amazing.

Waneck
  • 2,450
  • 1
  • 19
  • 31