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. tcp、udp协议栈

    tcp struct tcphdr { __be16 source; //源端口 __be16 dest; //目的端口 __be32 seq; //序列号 __be32 ack_seq; //确认号 ...

  2. linux修改当前用户环境变量永久生效

    在linux环境中,修改当前用户环境变量,且永久生效的方法如下. 1,编辑~/.bash_profile文件 1 2 3 # Get the aliases and functions 4 if [ ...

  3. Flink源码分析 - 剖析一个简单的Flink程序

    本篇文章首发于头条号Flink程序是如何执行的?通过源码来剖析一个简单的Flink程序,欢迎关注头条号和微信公众号"大数据技术和人工智能"(微信搜索bigdata_ai_tech) ...

  4. StringUtils系列之StringUtils.isNotBlank()和StringUtils.isNotBlank()的区别

    /** 1. * StringUtils.isNotBlank(); * 判断参数是否不为空. * 1.如果不为空返回true. * 2.如果为空返回false. * StringUtils.isNo ...

  5. manjaro跳坑记

    why manjaro 有两个原因: 我的电脑上win10+ubuntu16.04,ubuntu上跑一个程序会crash导致重启,不知道如何排查,想换个系统试试.(别人机器上同样G++版本不会cras ...

  6. 三、Linux_环境变量

    环境变量配置: # 每次进入命令都要重新source /etc/profile 才能生效? # 解决办法:将环境变量放置到~/.bashrc文件中 $ vim ~/.bashrc # 在里面添加相关的 ...

  7. FreeBSD更换国内源(pkg源使用台湾源,中科大源备用)

    安装后第一件事就是更换国内源,不然后面安装桌面等,不用国内源下载太慢. 修改 pkg 源 创建用户级 pkg 源目录:mkdir -p /usr/local/etc/pkg/repos ee /usr ...

  8. 树莓派3b安装opencv

    前言:最近买了一个CSI接口的摄像头,最准用树莓派做人脸识别项目.树莓派上本身已经安装了python2.python3,最开始通过sudo apt-get install python3-opencv ...

  9. Jenkins持续集成邮件发送

    jenkins下载:https://jenkins.io/downloadgeneric java package(war) 1.tomcat部署: 0.jdk环境 1.修改conf目录下的serve ...

  10. Python 通过lxml 解析html页面自动组合xpath实例

    #coding:utf-8 ''' @author: li.liu ''' from selenium import webdriver from selenium.webdriver.common. ...