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

日常开发工作中,经常碰到要对图片进行一些简单的处理,不需要动用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
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

mac上使用sips命令快速裁剪、旋转、翻转图片的更多相关文章

  1. 在Mac上配置adb命令

    在Mac上配置adb命令 在Mac OS中使用adb命令时,应进行变量配置,步骤如下: 一.终端中输入 cd ~ 二.输入touch .bash_profile 回车 touch:如果没有,则创建文件 ...

  2. 在 Mac 上使用 `sed` 命令的几个坑

    不可忽略的备份格式 sed -i 's/hello/world/g' hello.text 上面这行代码,可以在 linux 上运行,作用是将找到的 hello 替换为 world,并且直接保存修改到 ...

  3. 如何在Mac上使用Netstat命令

    macOS上的netstat命令是一个终端命令,用于显示有关Mac网络通信的详细信息.网络通信包括Mac通过所有端口和所有应用程序与外界进行交流的所有方式.掌握netstat可以帮助您了解计算机之间的 ...

  4. mac上的svn命令

    Mac 终端添加代码到SVN从SVN拉取代码步骤:1.cd /Users/指定路径(本地路径)2.svn checkout https://xxx.xxx.xx/svn/project(服务器路径) ...

  5. mac上使用git命令上传项目工程源码至Github/gitee

    原文连接:(http://www.studyshare.cn/blog/details/1164/0 ) 一.安装git工具 1.官网下载地址:点击下载  安装步骤略,mac安装工具双击拖动即可. 2 ...

  6. Mac上一条命令搭建web服务器

    实际测试工作中偶尔会需要搭建Web服务器环境,由于Mac OS X自带了Apache和PHP环境,只需要简单的启动就可以. 开启Apache 开启Web服务器的方法有两种(默认启动端口号是80): 打 ...

  7. react-native在mac上执行gradlew命令报错 ./gradlew: command not found

    这是因为react-native项目是windows上初始化,通过git clone到mac机器上后gradlew这个文件没有可执行权限,如图: 所以只需要给gradlew这个文件增加可执行权限就可以 ...

  8. Mac 上所有的命令行相关问题的总结

    1. java 系列命令 jdk,jar,war等等文件的执行方式 2. brew 系列命令 安装各种其他程序的命令例如:jenkins,MySQL,openssl brew list   列出所有的 ...

  9. mac上使用imagealpha命令对图片进行压缩批处理

    #! /bin/bash #BASE_DIR="/Users/jiading/Documents/basepng"; #OUTPUT_DIR="/Users/jiadin ...

随机推荐

  1. SAP Hybris Discount group,折扣组,折扣记录,用户组几组概念的关联

    在backoffice的Price Settings->Discount->Customer Discount Groups菜单下面,创建一个新的Customer Discount Gro ...

  2. k8s namespace权限问题无法读取configmap

    报错信息: Message: Forbidden!Configured service account doesn't have access. Service account may have be ...

  3. LINUX下查看日志信息

    Linux下grep显示多行信息标准unix/linux下的grep通过以下参数控制上下文 grep -C 5 foo file 显示file文件中匹配foo字串那行以及上下5行 例如 grep -C ...

  4. window安装gcc、g++、make等编译环境

    1. MinGW官网下载:http://www.mingw.org        点击右上角Downloads 点击下载 mingw-get-setup.exe 2. 百度网盘(2019年4月从官网下 ...

  5. varnish加速web

    varnish主要功能是代理服务器和缓存,和nginx代理一样可以反向代理web服务器.但是varnish不能作为web服务器.但是它的优点是可以将访问过的网站还存在代理服务器上,以便于提升web的访 ...

  6. c语言实现基本的数据结构(二) 链表(包括链表的三种简单排序算法)

    #include "stdafx.h" #include <stdlib.h> //创建一个节点,data为value,指向NULL Node* Create(int ...

  7. 洛谷 P1219 八皇后题解

    题目描述 检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行.每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子. 上面的布局可以用序列2 4 6 1 3 ...

  8. 微信小程序~上拉加载onReachBottom

    代码: //页面上拉触底事件的处理函数 onReachBottom(e) { console.log("底部")// 滚动到页面执行 该 方法 wx.showToast({ tit ...

  9. pycharm——常用快捷键操作

    编辑类(Editing): Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + Alt + Space 类名完成Ctrl + Shift + Enter 语句完成Ctrl + P ...

  10. 深度学习Keras框架笔记之AutoEncoder类

    深度学习Keras框架笔记之AutoEncoder类使用笔记 keras.layers.core.AutoEncoder(encoder, decoder,output_reconstruction= ...