iOS: 用shell脚本批量剪裁APP图标
2016-04-16 本文已影响342人
疯狂的向日葵
1.脚本如下:
#!/bin/sh
filename="icon.png"
dirname="image"
filename_array=("Icon-1.png" "Icon-2.png" "Icon-60.png" "Icon-60@2x.png" "Icon-72.png" "Icon-72@2x.png" "Icon-76.png" "Icon-76@2x.png" "Icon-ad32.png" "Icon-ad48.png" "Icon-ad72.png" "Icon-ad96.png" "Icon-ad144.png" "Icon-Small-1.png" "Icon-Small.png" "Icon-Small@2x-1.png" "Icon-Small@2x.png" "Icon-Spotlight-iOS7-1.png" "Icon-Spotlight-iOS7.png" "Icon-Spotlight-iOS7@2x-1.png" "Icon-Spotlight-iOS7@2x.png" "Icon-Spotlight.png" "Icon-Spotlight@2x.png" "Icon.png" "Icon@2x.png")
size_array=("58" "58" "60" "120" "72" "144" "76" "152" "32" "48" "72" "96" "144" "29" "29" "58" "58" "40" "40" "80" "80" "50" "100" "57" "114")
mkdir $dirname
for ((i=0;i<${#size_array[@]};++i)); do
mkdir $dirname
m_dir=$dirname/${filename_array[i]}
cp $filename $m_dir
sips -Z ${size_array[i]} $m_dir
done
2.新建一个text,拷贝脚本进去,保存为.sh格式
3.新建一个文件夹,把你要剪裁的icon图标,和你的脚本扔进去
脚本.png4.打开终端,cd到这个文件夹,终端输入
sh xx.sh