mac 命令行生成不同尺寸的Icon

原文:http://www.jb51.net/article/48018.htm

 

 

在命令行输入 :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

 

这是苹果电脑自带的功能。

只需要进入某一个含有Icon.png的目录里面打下下面的命令就OK了。你要 的尺寸就自动生成了。。

 

http://www.jb51.net/article/48018.htm

#!/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

 

 

 #!/bin/sh

filename="icon.png"

dirname="cutimg"

name_array=("[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]" "[email protected]")

size_array=("120" "180" "80" "120" "58" "87" "87")

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 

猜你喜欢

转载自zhangmingwei.iteye.com/blog/2066419
今日推荐