制作 Automator 脚本

打开 Automator -> 选择服务,左侧搜索 shell,双击打开,右侧粘贴以下内容,将上部 服务收到... 改成 没有输入CMD+S保存,名称就叫 屏幕快照@1x

然后退出程序,这部分工作已经结束了。

# 保存到桌面同时复制到剪贴板
# the path where screenshots to save
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
SS_PATH="/Users/`whoami`/Desktop" # a variable of unix timestamp for screenshot file name
NOW=$(date +"%Y-%m-%d %H.%M.%S") # image format to create, default is png (other options include pdf, jpg, tiff and other formats)
SS_TYPE=JPG # name of screenshot
SS_NAME=屏幕快照$NOW # full path of screenshot file
SS_1X=$SS_PATH/$SS_NAME@1X.$SS_TYPE
SS_2X=$SS_PATH/$SS_NAME@2X.$SS_TYPE # execute screen capture command and save to $SS_2X
screencapture -i -r -t $SS_TYPE $SS_2X # check if screenshot is existing
if [ -f $SS_2X ]; then # get the 50% width of screenshot by sips
WIDTH=$(($(sips -g pixelWidth $SS_2X | cut -s -d ':' -f 2 | cut -c 2-)/2)) # scale down by sips
sips --resampleWidth $WIDTH $SS_2X --out $SS_1X # copy small one to clipboard by applescript
# if you hold control key when do capture, causes screen shot 2X to go to clipboard
# osascript -e 'set the clipboard to POSIX file "'$SS_1X'"'
osascript -e 'set the clipboard to (read (POSIX file "'$SS_1X'") as JPEG picture)' # delete 2X screen shot
rm $SS_2X
fi

设置快捷键支持

打开系统偏好设置->键盘->快捷键,左侧选中服务,右侧找到通用下的屏幕快照@1x,设置快捷键Shift+CMD+2(或者其他未被系统占用的快捷键),然后关闭界面。

使用

任意程序内,按下设置的快捷键 Shift+CMD+2(截图操作时顶部状态栏右侧会有小齿轮旋转图标)

桌面会生成屏幕快照 [当前时间]@1X.JPG命名的图像,并且内容也复制到系统剪切板,其他程序内直接粘贴即可。

其他可选脚本

# 只保存到桌面
# the path where screenshots to save
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
SS_PATH="/Users/`whoami`/Desktop" # a variable of unix timestamp for screenshot file name
NOW=$(date +"%Y-%m-%d %H.%M.%S") # image format to create, default is png (other options include pdf, jpg, tiff and other formats)
SS_TYPE=JPG # name of screenshot
SS_NAME=屏幕快照$NOW # full path of screenshot file
SS_1X=$SS_PATH/$SS_NAME@1X.$SS_TYPE
SS_2X=$SS_PATH/$SS_NAME@2X.$SS_TYPE # execute screen capture command and save to $SS_2X
screencapture -i -r -t $SS_TYPE $SS_2X # check if screenshot is existing
if [ -f $SS_2X ]; then # get the 50% width of screenshot by sips
WIDTH=$(($(sips -g pixelWidth $SS_2X | cut -s -d ':' -f 2 | cut -c 2-)/2)) # scale down by sips
sips --resampleWidth $WIDTH $SS_2X --out $SS_1X # copy small one to clipboard by applescript
# if you hold control key when do capture, causes screen shot 2X to go to clipboard
# osascript -e 'set the clipboard to POSIX file "'$SS_1X'"'
# osascript -e 'set the clipboard to (read (POSIX file "'$SS_1X'") as JPEG picture)' # delete 2X screen shot
rm $SS_2X
fi
# 只复制到剪贴板
# the path where screenshots to save
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
SS_PATH="/Users/`whoami`/Desktop" # a variable of unix timestamp for screenshot file name
NOW=$(date +"%Y-%m-%d %H.%M.%S") # image format to create, default is png (other options include pdf, jpg, tiff and other formats)
SS_TYPE=JPG # name of screenshot
SS_NAME=屏幕快照$NOW # full path of screenshot file
SS_1X=$SS_PATH/$SS_NAME@1X.$SS_TYPE
SS_2X=$SS_PATH/$SS_NAME@2X.$SS_TYPE # execute screen capture command and save to $SS_2X
screencapture -i -r -t $SS_TYPE $SS_2X # check if screenshot is existing
if [ -f $SS_2X ]; then # get the 50% width of screenshot by sips
WIDTH=$(($(sips -g pixelWidth $SS_2X | cut -s -d ':' -f 2 | cut -c 2-)/2)) # scale down by sips
sips --resampleWidth $WIDTH $SS_2X --out $SS_1X # copy small one to clipboard by applescript
# if you hold control key when do capture, causes screen shot 2X to go to clipboard
# osascript -e 'set the clipboard to POSIX file "'$SS_1X'"'
osascript -e 'set the clipboard to (read (POSIX file "'$SS_1X'") as JPEG picture)' # delete 2X screen shot
rm $SS_2X
# delete 1X screen shot
rm $SS_1X
fi

最后感慨一句,虽然 Automator 里边的 AppleScript 语言很难用,但 Automator 这个工具还是很强大的,好好利用确实能让工作效率提高很多。

参考

脚本改自原作者:

https://derekswingley.com/2016/09/06/how-to-take-1x-screen-shots-on-a-retina-mac/

macOS 不用任何第三方工具 简单两步使用 Automator 将截图转成@1x的更多相关文章

  1. 简单两步使用css控制div下导航栏ul居中显示

    第一步:父层设置文本居中属性 ul{ text-align:center; } 第二步:li设置内联样式 li{ display:inline; } PS 只需以上两步就可以实现导航栏居中显示了,但为 ...

  2. 【路由达人】简单两步搞定小米路由新增功能-DDNS(解析域名地址转向在线工具)

    DDNS(Dynamic Domain Name Server)是动态域名服务的缩写! 简单来说目前ISP大多为我们提供动态IP(如ADSL拨号上网),而很多设备或服务需要通过远程访问时需要一个固定的 ...

  3. 超简单(两步)-微信怎么实现打开外部浏览器,下载app,打开网页URL

    现在微信渠道可以说是拉新最快的渠道,因为微信具备强裂变性.但是目前微信对第三方下载链接的拦截是越来越严格了,那么想要在微信内肆无忌惮地推广链接就需要用到微信跳转浏览器的接口,那如何获取该接口呢?   ...

  4. 简单两步快速实现shiro的配置和使用,包含登录验证、角色验证、权限验证以及shiro登录注销流程(基于spring的方式,使用maven构建)

    前言: shiro因为其简单.可靠.实现方便而成为现在最常用的安全框架,那么这篇文章除了会用简洁明了的方式讲一下基于spring的shiro详细配置和登录注销功能使用之外,也会根据惯例在文章最后总结一 ...

  5. 利用stylist插件,简单两步屏蔽新浪微博上的广告

    以前新浪微博只是在侧栏有几块小小的广告,还算可以接受,想着忍忍就算了,可最近真是越来越不厚道了,自从和淘宝合作之后,侧栏就开始有一大块广告根据你在淘宝的搜索记录推荐商品,更可恶的是信息流里的祛痘微博现 ...

  6. 简单两步快速学会使用Mybatis-Generator自动生成entity实体、dao接口和简单mapper映射(用mysql和oracle举例)

    前言: mybatis-generator是根据配置文件中我们配置的数据库连接参数自动连接到数据库并根据对应的数据库表自动的生成与之对应mapper映射(比如增删改查,选择性增删改查等等简单语句)文件 ...

  7. 所有eclipse版本,主题黑化,代码黑化的简单两步

    一.下载两个文件 二.打开eclipse,Import   .epf文件 三.把.jar 复制到 eclipse的plugins目录下,重启eclipse 效果如下: 注 以上方法:来自互联网

  8. ubuntu更新源,简单两步搞定

    1.启动器中打开Ubuntu软件中心 2.鼠标顶部面板点击编辑选择软件源(163.sohu) 搞定!

  9. 简单两步 ~ 绕过 "Paused in debugger"

    不BB,上图 然后刷新一下就ok了~再也不能阻止我们查看源码了~ 补充:(屏蔽在Sources里面)

随机推荐

  1. POJ3069 Saruman's Army【贪心】

    Saruman the White must lead his army along a straight path from Isengard to Helm's Deep. To keep tra ...

  2. Python之Django的Model2

    一.创建数据库 创建数据库 进入数据库: mysql -uroot -p 创建数据库: CREATE DATABASE test1 CHARSET=utf8; 连接数据库 虚拟环境中安装数据库模块:p ...

  3. Official Documents

    1. Docker Installation https://docs.docker.com/install/linux/docker-ee/suse/ 2. Docker hub https://d ...

  4. 0926mysql join的原理

    转自 http://www.cnblogs.com/shengdimaya/p/7123069.html MySQL JOIN原理   先看一下实验的两张表: 表comments,总行数28856 表 ...

  5. sync_binlog=1

    MySQL提供一个sync_binlog参数来控制数据库的binlog刷到磁盘上去. sync_binlog=0,表示MySQL不控制binlog的刷新,由文件系统自己控制它的缓存的刷新.这时候的性能 ...

  6. 用hadoop实现SimRank++算法(1)----权值转移矩阵的计算

    本文主要针对广告检索领域的查询重写应用,依据查询-广告点击二部图,在MapReduce框架上实现SimRank++算法.关于SimRank++算法的背景和原理请參看前一篇文章<基于MapRedu ...

  7. redhat gitlab的搭建

    http://www.cnblogs.com/derekchen/p/5870723.html 1.新建 /etc/yum.repos.d/gitlab-ce.repo,添加以下内容 [gitlab- ...

  8. Camera-hal参数调整

    路径: vendor/mediatek/proproetary/custom/mt6735/hal/D1/imgsensor/对应的SENSOR目录 .../D1/flashlight/flash_t ...

  9. ubuntu清华源【转】

    https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 可以选择ubuntu的版本更新源.

  10. bzoj5029: 贴小广告&&bzoj5168: [HAOI2014]贴海报

    以后做双精题请至少先跑个数据...输入都不一样... 做法就是离散化大力线段树. 记得在x+1和y-1插点 看这个数据: 1000 121 10050 8080 9950 981 56100 2002 ...