前言
每次制作mac的icns图标时都非常麻烦,需要执行一大段命令,索性就封装成一个shell轻快
效果如下

脚本内容
#!/bin/bash
# @Author: 鲁恺文
# @Email: kevinlu98@qq.com
# @Date: 2021-08-31 14:08
# @Desc:
#
if [ $# -eq 0 ];
then
echo 请输入参数[input]!
exit
fi
input=$1
if [ -f $input ];then
echo "输入文件为$input"
else
echo "文件\"$input\"不存在"
fi
temp_dir=${input%.*}.iconset
mkdir $temp_dir
sizes=(16 32 64 128 256 512 1024)
for size in ${sizes[@]};
do
echo "正在生成${size}x${size}的图标..."
sips -z $size $size $input --out $temp_dir/icon_${size}x${size}.png
done
echo "所有尺寸图标生成成功!"
echo "正在合成icns图标..."
output=${input%.*}.icns
iconutil -c icns $temp_dir -o $output
rm -fr $temp_dir
echo "图标合成成功!\n输出路径为\"$output\""
我喜欢, 这里分享真实经验。你的项目 就是 最好的例子。请继续。
美好的 博客内容! 继续创作。
素材精彩极了。由衷感谢 带来的灵感。
支持,下载瞧瞧效果
非常有用的 旅行博客, 不要停下 方向正确。衷心感谢.