linux批量切割图片,MAC中用Shell脚本批量裁剪各种尺寸的App图标
在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),可用于查詢和修改圖像文件。
下面是剛寫(xiě)的IOS App Icon裁剪腳本,保存成一個(gè).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")
mkdir $dirname
for ((i=0;i
m_dir=$dirname/${name_array[i]}
cp $filename $m_dir
sips -Z ${size_array[i]} $m_dir
done
總結(jié)
以上是生活随笔為你收集整理的linux批量切割图片,MAC中用Shell脚本批量裁剪各种尺寸的App图标的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: php元素浮动会产生哪些影响,css浮动
- 下一篇: k1658停运_最新通知!福州这些列车停