linux批量切割图片,MAC中用Shell脚本批量裁剪各种尺寸的App图标

本文介绍了如何利用Mac内置的sips工具自动化裁剪iOS应用所需的多种尺寸图标,避免手动操作,提高工作效率。通过编写并运行.sh脚本,可以一键完成所有图标尺寸的转换。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在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")

mkdir $dirname

for ((i=0;i

m_dir=$dirname/${name_array[i]}

cp $filename $m_dir

sips -Z ${size_array[i]} $m_dir

done

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值