flycappuccino 2014-03-12
在APP上架前,一次一次自己剪裁上架需要的各个尺寸的Icon不是程序员该干的事,使用Mac中自带的sips工具可以解决这个需求。
关于sips,在终端中直接执行可以出现以下信息:
代码如下:
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
代码如下:
#!/bin/sh filename="icon.png" dirname="cutimg" name_array=("Icon-29.png" "[email protected]" "[email protected]" "Icon-57.png" "[email protected]" "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