pngquant is available as a clean C library .
ImageMagick uses octtree , which is fast but not the best quality.
pngquant uses MedianCut with a few additional enhancements and is likely to give higher quality.
pngquant has a speed / quality compromise setting that can improve the quality a bit further, and also has a custom anti-aliasing algorithm (modified by Floyd-Steinberg) that does not add noise to well-quantized areas of the image.
source
share