mac上使用sips命令快速裁剪、旋转、翻转图片

原文:https://www.cnblogs.com/stono/p/11021060.html

日常开发工作中,经常碰到要对图片进行一些简单的处理,不需要动用PS,在mac上就有一个很好的命令行工具:sips
这里我们不具体展开讲,仅贴出几个常用的操作示例,更多用法请大家自行研究
自适应裁剪图片
sips -Z 600 meinv.jpg
其中600表示高度为600px,宽度为按比例缩放
固定宽度
sips -z 100 200 meinv.jpg
其中100表示高度为100px,宽度为200px
旋转
sips -r 90 meinv.jpg
向右旋转90度
水平方向/垂直方向翻转图片
sips -f horizontal meinv.jpg
sips -f vertical meinv.jpg
最后附上spis的帮助信息
➜ doc sips --help
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.
Usages:
sips [-h, --help]
sips [-H, --helpProperties]
sips [image-query-functions] imagefile ...
sips [profile-query-functions] profile ...
sips [image modification functions] imagefile ...
[--out result-file-or-dir]
sips [profile modification functions] profile ...
[--out result-file-or-dir]
Profile query functions:
-g, --getProperty key
-X, --extractTag tag tagFile
-v, --verify
Image query functions:
-g, --getProperty key
-x, --extractProfile profile
Profile modification functions:
-s, --setProperty key value
-d, --deleteProperty key
--deleteTag tag
--copyTag srcTag dstTag
--loadTag tag tagFile
--repair
Image modification functions:
-s, --setProperty key value
-d, --deleteProperty key
-e, --embedProfile profile
-E, --embedProfileIfNone profile
-m, --matchTo profile
-M, --matchToWithIntent profile intent
--deleteColorManagementProperties
-r, --rotate degreesCW
-f, --flip horizontal|vertical
-c, --cropToHeightWidth pixelsH pixelsW
-p, --padToHeightWidth pixelsH pixelsW
--padColor hexcolor
-z, --resampleHeightWidth pixelsH pixelsW
--resampleWidth pixelsW
--resampleHeight pixelsH
-Z, --resampleHeightWidthMax pixelsWH
-i, --addIcon

作者:上官伟斌
链接:https://www.jianshu.com/p/56a656181f30
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

原文地址:https://www.cnblogs.com/albert1017/p/14511217.html