TinyPNG is a web service that allows you to reduce the size of your images with no perceptible loss in quality, while shrinking the size of your files significantly. It's brilliantly useful, so we've made a workflow for it!
You can compress PNG, JPEG, and WebP images without having to hop over to their website and manually dragging in images, as their API makes it a breeze to use directly from the TinyPNG Alfred workflow.
Whether you're designing a new website, posting to your blog or creating an Alfred workflow, the more optimised the images are, the more lightweight your page or workflow will be. Using TinyPNG can shrink a file size to a tenth its original size, making your exported workflow far more suitable for sharing!
Setting up the TinyPNG Workflow
1. Install the workflow
Install the TinyPNG Alfred Workflow from the Alfred Gallery, which will launch Alfred's preferences and pop up the workflow's Readme and setup window.
2. Get your API key
Because TinyPNG's compression is lossy - meaning information is discarded - the Workflow backs up your originals. By default, they are saved to a temporary directory which is cleaned on every reboot.
As of writing, TinyPNG lets you compress 500 images per month for free.
3. Choose your favourite way to use the workflow
To use it as a File Action, select one or more files in Alfred or Finder, and use your Universal Action hotkey (which is
⌘/ by default) to pop up the list of actions. You can then type "tinypng" or choose "TinyPNG Compression" from the actions list.
To use the File Filter, use the keyword "tinypng" in Alfred to choose the workflow, then search for the name of the image you want to optimise.
And finally, you can use an External Trigger to call this action from another workflow or AppleScript.
tell application id "com.runningwithcrayons.Alfred" run trigger ¬ "compress" in workflow ¬ "com.alfredapp.tinypng" with argument ¬ (POSIX path of (path to desktop folder)) & "tinypng panda.png" end tell
Enjoy your efficiency boost!