当我们获取到一些iOS的app包后,发现里面的png图片使用系统的预览看不了。因为在Xcode生成应用程序包时,自动将png图片进行优化,而优化后的图片不能直接使用预览查看,这个优化工具时pngcrush。它也提供了还原的功能,使图片再度可见。为了批量处理这些图片,我写了一个脚本:
1
2
3
4
5
6
7
8
9
10
11
|
#/bin/sh filelist=`find
$ 1 -name
"* .png "` #echo
"$filelist" echo
"$filelist"| while read
file do echo
$file /Developer/Platforms/iPhoneOS .platform /Developer/usr/bin/pngcrush
-revert-iphone-optimizations -q $file $file .png rm
$file mv
$file .png $file |
可以直接使用命令:
pngdecode 目录
使用后自动将目录下的所有png图片还原。