MAC中用Shell腳本批量裁剪各種尺寸的App圖標(biāo)
在APP上架前,一次一次自己剪裁上架需要的各個(gè)尺寸的Icon不是程序員該干的事,使用Mac中自帶的sips工具可以解決這個(gè)需求。
關(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
它一個(gè)腳本圖像處理系統(tǒng),可用于查詢和修改圖像文件。
下面是剛寫的IOS App Icon裁剪腳本,保存成一個(gè).sh文件,在終端里輸入sh xx.sh就可以執(zhí)行了:
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ǔ)學(xué)習(xí)詳細(xì)介紹(完整版)
Linux shell腳本基礎(chǔ)學(xué)習(xí)我們將分幾講來(lái)慢慢細(xì)說(shuō),希望能對(duì)想學(xué)習(xí)Linux shell腳本編程的初學(xué)者有一個(gè)明確的幫助,水平得到提高2013-07-07淺析Linux系統(tǒng)下安裝wetty和使用說(shuō)明
本篇文章主要給大家介紹linux系統(tǒng)下安裝wetty和使用說(shuō)明,以及l(fā)inux tty命令學(xué)習(xí)總結(jié),感興趣的朋友跟著小編一起學(xué)習(xí)吧2015-10-10shell編程中for循環(huán)語(yǔ)句的實(shí)現(xiàn)過(guò)程及案例
Bash?Shell中主要提供了三種循環(huán)方式:for、while和until,下面這篇文章主要給大家介紹了關(guān)于shell編程中for循環(huán)語(yǔ)句的實(shí)現(xiàn)過(guò)程及案例,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-04-04shell隨機(jī)定時(shí)修改密碼change_passwd.sh
這篇文章主要介紹了shell隨機(jī)定時(shí)修改密碼change_passwd.sh,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-12-12shell腳本實(shí)現(xiàn)實(shí)時(shí)檢測(cè)文件變更
這篇文章主要介紹了shell腳本實(shí)現(xiàn)實(shí)時(shí)檢測(cè)文件變更,本文直接給出實(shí)現(xiàn)代碼和使用方法,以及svn下的實(shí)現(xiàn)代碼,需要的朋友可以參考下2015-05-05