使用OptiPNG优化压缩图片

因工作需要,得处理一张7872x5904体积为178MB的图片,格式为TIFF。

网上搜了半天,找到一个名为OptiPNG的软件,主要为PNG优化,但也支持TIFF格式。

下面是OptiPNG的官方介绍

OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.

OptiPNG可以将PNG文件重新压缩,压缩后体积变得更小,并且不会丢失任何信息。同时optipng还支持其他格式的图片,如BMP、GIF、PNM和TIFF。

至于OptiPNG的威力如何,请看本次实例

root@raspi:~# ls -lh huxian.tif                         
-rw-r--r-- 1 root root 178M Apr  4 16:54 huxian.tif    //原始文件178MB
root@raspi:~# optipng huxian.tif
** Processing: huxian.tif
Importing TIFF
7872x5904 pixels, 4x8 bits/pixel, RGB+alpha   //分辨率7872x5904
Reducing image to 3x8 bits/pixel, RGB
Input file size = 186000368 bytes

Trying:
zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 4273133

Selecting parameters:
zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 4273133

Output file: huxian.png

Output IDAT size = 4273133 bytes
Output file size = 4273190 bytes (181727178 bytes = 97.70% decrease)

root@raspi:~# ls -lh huxian*
-rw-r--r-- 1 root root 4.1M Apr  4 17:02 huxian.png   //压缩结果4.1MB
-rw-r--r-- 1 root root 178M Apr  4 16:54 huxian.tif

看来OptiPNG还是很牛的嘛!!!

OptiPNG官方地址 http://optipng.sourceforge.net/

官方提供源码和Windows编译版,Debian/Ubuntu系统可以通过apt-get install optipng来安装。