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

作者

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

pngqunat 安装的脚本

yum install which gcc git libpng-devel make -y
cd ~
git clone git://github.com/kornelski/pngquant.git
cd pngquant
 ./configure
make install

查看 pngquant 的安装位置

which pngquant
/usr/local/bin/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

官方网站

https://pngquant.org

查看pngquant帮助


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.

3 评论

回复

您的电子邮箱地址不会被公开。