MAC中用Shell腳本批量裁剪各種尺寸的App圖標
更新時間:2014年03月12日 14:41:10 作者:
這篇文章主要介紹了在MAC中用Shell腳本批量裁剪各種尺寸的App圖標的方法,需要的朋友可以參考下
在APP上架前,一次一次自己剪裁上架需要的各個尺寸的Icon不是程序員該干的事,使用Mac中自帶的sips工具可以解決這個需求。
關(guān)于sips,在終端中直接執(zhí)行可以出現(xiàn)以下信息:
復制代碼 代碼如下:
sips 10.4.4 - scriptable image processing system.
This tool is used to query or modify raster image files and ColorSync ICC profiles.
Its functionality can also be used through the "Image Events" AppleScript suite.
Try 'sips --help' or 'sips --helpProperties' for help using this tool
它一個腳本圖像處理系統(tǒng),可用于查詢和修改圖像文件。
下面是剛寫的IOS App Icon裁剪腳本,保存成一個.sh文件,在終端里輸入sh xx.sh就可以執(zhí)行了:
復制代碼 代碼如下:
#!/bin/sh
filename="icon.png"
dirname="cutimg"
name_array=("Icon-29.png" "Icon-29@2x.png" "Icon-40@2x.png" "Icon-57.png" "Icon-57@2x.png" "Icon-120.png")
size_array=("29" "58" "80" "57" "114" "120")
filename="icon.png"
dirname="cutimg"
name_array=("Icon-29.png" "Icon-29@2x.png" "Icon-40@2x.png" "Icon-57.png" "Icon-57@2x.png" "Icon-120.png")
size_array=("29" "58" "80" "57" "114" "120")
mkdir $dirname
for ((i=0;i<${#name_array[@]};++i)); do
m_dir=$dirname/${name_array[i]}
cp $filename $m_dir
sips -Z ${size_array[i]} $m_dir
done
相關(guān)文章
Linux shell腳本基礎(chǔ)學習詳細介紹(完整版)
Linux shell腳本基礎(chǔ)學習我們將分幾講來慢慢細說,希望能對想學習Linux shell腳本編程的初學者有一個明確的幫助,水平得到提高2013-07-07shell編程中for循環(huán)語句的實現(xiàn)過程及案例
Bash?Shell中主要提供了三種循環(huán)方式:for、while和until,下面這篇文章主要給大家介紹了關(guān)于shell編程中for循環(huán)語句的實現(xiàn)過程及案例,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考下2022-04-04