最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Linux下压缩和优化jpg与png图片的方法
时间:2022-06-30 16:18:51 编辑:袖梨 来源:一聚教程网
jpegotim压缩jpg图片
安装jpegotim
如果你有epel yum源,使用如下命令即可
# yum install jpegoptim
压缩图片命令
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/
# tar -xzvf pngcrush-1.7.88.tar.gz
# cd pngcrush-1.7.88
# make
# cp pngcrush /usr/bin
pngcrush使用语法
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简单命令
.........省略.....
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图片
pngcrush -brute -d "/data/site/image.ttlsa.com/images" *.png
相关文章
- win11电脑突然关机文件没保存如何解决? 08-02
- 《QQ》接不到电话方法解决方法 08-02
- 永劫无间卡顿不流畅怎么解决?永劫无间卡顿解决方法 08-02
- 胖企鹅(PENGU)价格预测:看涨旗形为8月冲击0.11美元埋下伏笔 08-02
- 《原神》5.6版本上半卡池抽取建议 08-02
- 《指尖无双》所有卡池保底机制一览2025 08-02