pngquant 一个很棒的png图片压缩工具


pngquant 是一个png图片的压缩工具。找了几张png图片,进行测试。对于一些未处理的png图片,压缩的效果还是很好的。通常可以压缩70%

pngqunat 安装的脚本

yum install which gcc git libpng-devel make -y
cd ~
git clone git://
cd pngquant
make install

查看 pngquant 的安装位置

which pngquant


  1. -f 输出文件强制覆盖
  2. -o 指定输出的文件名字
  3. --ext 指定后缀
  4. --quality 图片质量


du test.png -h
1.3M    test.png

pngquant test.png
du * -h
316K    test-fs8.png
1.3M    test.png

# 输出的名字是 test2.png
pngquant test.png -o test2.png

# 使用f强制覆盖
pngquant test.png -o test2.png
  error: 'test2.png' exists; not overwriting
pngquant test.png -o test2.png -f



usage: pngquant [options] [ncolors] -- pngfile [pngfile ...] pngquant [options] [ncolors] - >stdout <stdin options: --force overwrite existing output files (synonym: -f) --skip-if-larger only save converted files if they're smaller than original --output file destination file path to use instead of --ext (synonym: -o) --ext new.png set custom suffix/extension for output filenames --quality min-max don't save below min, use fewer colors below max (0-100) --speed N speed/quality trade-off. 1=slow, 4=default, 11=fast & rough --nofs disable Floyd-Steinberg dithering --posterize N output lower-precision color (e.g. for ARGB4444 output) --strip remove optional metadata (default on Mac) --verbose print status messages (synonym: -v) Quantizes one or more 32-bit RGBA PNGs to 8-bit (or smaller) RGBA-palette. The output filename is the same as the input name except that it ends in "-fs8.png", "-or8.png" or your custom extension (unless the input is stdin, in which case the quantized image will go to stdout). If you pass the special output path "-" and a single input file, that file will be processed and the quantized image will go to stdout. The default behavior if the output file exists is to skip the conversion; use --force to overwrite. See man page for full list of options.