您现在的位置是:网站首页> 编程资料编程资料
MAC中用Shell脚本批量裁剪各种尺寸的App图标_linux shell_
2023-05-26
538人已围观
简介 MAC中用Shell脚本批量裁剪各种尺寸的App图标_linux shell_
在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
它一个脚本图像处理系统,可用于查询和修改图像文件。
下面是刚写的IOS App Icon裁剪脚本,保存成一个.sh文件,在终端里输入sh xx.sh就可以执行了:
复制代码 代码如下:
#!/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")
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
相关内容
- 在Shell命令行处理JSON数据的方法_linux shell_
- 用shell脚本在mysql表中批量插入数据的方法_linux shell_
- windows下写的shell脚本在linux执行出错的解决办法_linux shell_
- 用Shell脚本快速搭建Ubuntu下的Nodejs开发环境_linux shell_
- 用内置变量调试shell脚本的方法_linux shell_
- 一个测试下载速度的shell脚本_linux shell_
- 一个下载网页图片的shell脚本_linux shell_
- 杀掉oracle在线用户脚本分享_linux shell_
- shell实现四则运算简单方法_linux shell_
- SHELL四则运算和比较_linux shell_
