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
若下载失败 ,请到官网手动下载https://pngquant.org/releases.html
查看 pngquant 的安装位置
which pngquant /usr/local/bin/pngquant
常用选择,参数
-f
输出文件强制覆盖-o
指定输出的文件名字--ext
指定后缀--quality
图片质量
使用方法
du test.png -h 1.3M test.png pngquant test.pngdu * -h 316K test-fs8.png 1.3M test.png# 输出的名字是 test2.pngpngquant 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
官方网站
查看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.
若文章对您有帮助,帮忙点个赞!
(微信扫码即可登录,无需注册)