pngquant is a command-line utility to quantize and dither
32-bit RGBA PNGs down to 8-bit (or smaller) RGBA-palette PNGs, usually with a significant
reduction in file size (40-70% smaller than 24-bit PNGs).
This unique type of PNG supports full alpha transparency and is compatible with all modern web browsers, and has better fallback in IE6 than 24-bit PNGs.
Current version is 1.7.1 (changelog, feed). Written in C99. Available under a BSD-like license. The project is hosted on GitHub. To further reduce file size, you may want to consider optipng or ImageOptim. See Set custom extension for output filename. By default Speed/quality trade-off from 1 (brute-force) to 10 (fastest). The default is 3. Speed 10 has 5% lower quality, but is 8 times faster than the default. Workaround for IE6, which only displays fully opaque pixels. Print version information to stdout. Read image from stdin and send result to stdout. Stops processing of arguments. This allows use of file names that start with Instead of splitting boxes with largest volume or number of colors, boxes are selected to minimize variance from their median value. Histogram is built with addition of a basic perception model, which gives less weight to noisy areas of the image. To improve color further, histogram is adjusted in a process similar to gradient descent (Median Cut is repeated many times with more weight on poorly represented colors). Finally, colors are corrected using Voronoi iteration, which guarantees locally optimal palette. When remapping, error diffusion is applied only to areas where several neighboring pixels quantize to the same value, and which are not edges. This avoids adding noise to areas which have high visual quality without dithering.Features
Download
Command-line
GUI
pngquant and other tools by Kornel Lesiński.Source code
git clone git://github.com/pornel/improved-pngquant.gitManual
pngquant 256 *.png
… | pngquant 16 | …
Options
pngquant -h for full list of options.
-ext new.png-or8.png or -fs8.png is used.-speed N-iebugpngquant will make almost-opaque pixels fully opaque and will avoid creating new transparent colors.-version----. If you're using pngquant in a script, it's advisable to put this before file names:pngquant $OPTIONS -- "$FILE"Algorithm
pngquant uses modified version of Median Cut quantization algorithm and additional techniques to mitigate deficiencies of Median Cut.pngquant works in premultiplied alpha color space to give less weight to transparent colors.
pngnq — image quantizer using NeuQuant algorithm