linux压缩.z(Linux下压缩和优化jpg与png图片的方法)
jpegotim压缩jpg图片
安装jpegotim
如果你有epel yum源 ,使用如下命令即可压缩图片命令
ttlsa.jpg 1425x823 24bit N JFIF [OK] 1074449 --> 853514 bytes (20.56%), optimized.
可以看到ttlsa.jpg自动被压缩了20.56% 。
再压缩一次ttlsa.jpg 1425x823 24bit N JFIF [OK] 853514 --> 853514 bytes (0.00%), skipped.
图片已经被压缩过了 ,所以提示跳过 ,不需要在被压缩 。
提供一个批量压缩的脚本pngcrush优化PNG图片
项目地址:http://pmt.sourceforge.net/pngcrush/# wget http://downloads.sourceforge.net/project/pmt/pngcrush/1.7.88/pngcrush-1.7.88.tar.gz
# tar -xzvf pngcrush-1.7.88.tar.gz
# cd pngcrush-1.7.88
# make
# cp pngcrush /usr/binpngcrush使用语法
usage: pngcrush [options except for -e -d] infile.png outfile.png
pngcrush -e ext [other options] file.png ...
pngcrush -d dir/ [other options] file.png ...
pngcrush -ow [other options] file.png [tempfile.png]
pngcrush -n -v file.png ...
options:
-bail (bail out of trial when size exceeds best size found
-bit_depth depth (deprecated)
-blacken (zero samples underlying fully-transparent pixels)
-brute (use brute-force: try 148 different methods)
........更多内容请自己看帮助......pngcrush简单命令
pngcrush -brute -e "myimage_compressed.png" myimage.png
.........省略.....
Best pngcrush method = 123 (ws 15 fm 4 zl 9 zs 1) = 124820
for output to ttlsattlsa_new.png
(1.63% critical chunk reduction)
(1.63% filesize reduction)CPU time decoding 1.560, encoding 7.640, other 0.030, total 9.230 sec.
批量优化PNG图片
创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!