How to make a workflow to auto-compress a screenshot and copy it to the clipboard

Ramith Hettiarachchi
Mac O’Clock
Published in
2 min readMay 3, 2020

I’ve always wanted to reduce the file size of the screenshots I take from preview(in macOS). I usually copy-paste stuff to OneNote, so I needed to reduce the file sizes.

In this workflow, I can simply take a screenshot, and within like 3 seconds, the screenshot will be compressed and copied to the clipboard.

Head over to Automator to create the folder action:

Now select/create a new folder to which the screenshots will be saved (I created a new folder in documents and changed the location to which the screenshots are saved — https://www.macworld.co.uk/how-to/mac-software/change-where-mac-screenshots-saved-3682381/)

Then select “Run Shell Script” and paste the below code (make sure to select Pass input as arguments):

( ⚠️ paste in “Run Shell Script” — make sure to check paths and select Pass input as arguments)

Additional Steps

Step #1

You will need to install pngquant and zopflipng using.

brew install pngquant

brew install zopflipng

Step #2

Also to setup impbcopy (the tool which copies the pic to clipboard) please follow the instructions at the following gist (instructions as a comment — click the gist link). After installing, identify the installed path and replace it in the “Run shell script” paths accordingly:

(Steps to install impbcopy — go to the original link of this gist)

If you encounter any issue, feel free to comment here, I’ll help!

(After selecting this location, use your usual shortcut -> Command + Shift + 4)

--

--