Forget the complex or manual steps, or costly tools to get screen shots scaled down from a retina display. I have a shell script that triggers an interactive window screen capture, saves the screen shot (assumed to be 2x retina display), re-sizes it to 1x and compresses the PNG further! Best of all, it does not require paid software or Automator.

First off, some assumptions:

  • Only saves in PNG format.
  • Requires ImageOptim to be installed in Applications.
  • Must be run on a retina display at "default" resolution.

The last point is important because the script assumes the retina screen shot is 2x resolution. To make sure, check your Display Settings. Resolution should be Default for display and not Scaled!

To cut to the chase, here is the script:

if [ -z "$1" ]
 then out=screenshot`date "+%s"`
 else out=$1
screencapture -Wox $out@2x.png
if [ -f $out@2x.png ]; then
 width=$(($(sips -g pixelWidth $out@2x.png | cut -s -d ':' -f 2 | cut -c 2-)/2))
 sips -Z $width $out@2x.png --out $out@1x.png
 open -a ImageOptim $out@?x.png

And a bit of explanation:

  1. Check to see if a command line argument is provided - this should be the screen shot file name.
  2. If not, save to a file prefixed by screenshot followed by numbers (Epoch time, but who cares).
  3. Trigger the screen capture, by default on Window mode (press spacebar to toggle) and save it as the file name that ends with @2x.png. Yes, the script only supports PNG.
  4. If the file was successfully saved, then
    • Get the width and divide it by 2.
    • Open the images in ImageOptim, which automatically starts the compression process.

If you don't want to see the ImageOptim user interface, you could replace the line with /Applications/ $out@?x.png

On my machine, I put the script in my home directory as Do chmod +x, and invoke it from Terminal via ~/screencapture output_image. If you want to put it on the Desktop, with the intention of double clicking to run it, then rename the extension from .sh to .command.

Retina display default resolution

Back to the issue around Display scaling, here are the resolutions captured on my 13" MacBook Pro with retina:

Display Scaling Resolution Scale Factor
Larger text 2058x1280 0.608
Default (native resolution) 2560x1600 1.000
(Mid point) 2880x1800 1.250
More Space 3360x2100 1.625

This differs on all Macs, e.g. 15" MacBook Pro with retina has a native resolution of 2880x1800 (both the 13" and 15" have 16:10 aspect ratios).

BTW, to change the way the standard Command-Shift-4 screenshot is captured - disable shadow, change save location and file name respectively:

defaults write disable-shadow -bool true
defaults write location ~/Desktop/Screenshots
defaults write name "Screen"
killall SystemUIServer