Jump to content

Recommended Posts

ImageOptim Workflow for Alfred app
This is a wrapper Alfred workflow around the great ImageOptim-CLI library from Jamie Mason. Mason's library uses three image optimization applications to automate optimization of JPEGs and PNGs. It uses the open source ImageAlpha and ImageOptim apps, and the JPEGmini app, which is not free, but highly recommended. Together they shrink images like a beast.
My own addition to this image processing is that if JPEGmini is unavailable, it uses ImageMagik's mogrify to compress JPEGs to quality 75, if they're actually higher than 75. To do this, I'm also bundling ImageMagik'smogrify and identify. A quality of 75 is usually pretty safe and it still has a way smaller size and usual JPEGs saved from Photoshop without optimization. That being said, JPEGmini does way better job and it's recommended.
 
Requirements

  • ImageOptim, installed in /Applications folder.
  • ImageAlpha, installed in /Applications folder.
  • JPEGminioptional but recommended, installed in /Applications folder.
  • If using JPEGmini, you need to add Alfred 2 to the allowed apps in the accesibility list. Go to Preferences, Security and Privacy, Privacy tab, click the lock to allow changes, and drag the Alfred 2 app into the list.

Usage
 

1. find or select one or more images or folders, show the file actions in Alfred, and select "Optimize Images". Note that any Alfred's way of selecting files work, such us:

  • select one or multiple files/folder in finder and press ⌘ alt \
  • browsing or finding files in Alfred, and triggering actions for the file
  • saving files in Alfred's file buffer, and then ⌘ → to action buffered files.

optimize.png
 

2. You'll see a notification indicating the number of files to process. The work is done partially with AppleScript, so even if it's happening in the background, the apps are actually laoded and you can focus on them to check the status. Depending on the number and size of images, it could take a while.

notification-start.png
 

3. When the optimization is completed, you'll see another notification, indicating the original Kilobytes, the current Kilobytes, total savings and savings percent.

notification-feedback.png
 
Caveats
You shouldn't run optimizations in parallel. Tecnically you could if the batch already jumped to the next app (from JPEGmini to ImageOptim for example), but it's looking for trouble. I'll consider adding a check in the future to prevent parallel process from happening, but I'm affraid this could add other complications, as in how to clear the processing flag if optimization process is interrumpted earlier.
 
Installation
For OS X 10.9 Mavericks, Download the alfred-image-optim-workflow.alfredworkflow and import to Alfred 2.
For Previous OS X Versions, Download the alfred-image-optim-workflow.alfredworkflow and import to Alfred 2.
 
Source Code
Clone or Fork the Workflow: https://github.com/ramiroaraujo/alfred-image-optim-workflow
 
Changelog

  • 2014-01-06 - Released
  • 2014-01-23 - Added folder support, and correctly counting number of files inside folders
Edited by Ramiro Araujo
Link to comment
  • 3 weeks later...
  • 4 weeks later...
  • 4 months later...
  • 2 months later...

I just found out about ImageAlpha and liked the compression but not the time as I have lots of files to compress.

 

I searched online and found this site/post and downloaded Alfred 2 and bought the power pack upgrade

(I have no programming experience but thought I would give this a try.)

I uploaded the work file  for mac mavericks and downloaded  imagealpha and imageoptim

(I do not have the ImageOptim-CLI libraries installed like the previous poster.)

 

I have a similar experience to the previous poster of the set-up not working on my computer. 

 

I get the the notification that says this could take some time and then........... nothing. I did not get the second message and the work was not done.

I quit the program and tried again with 2 files-same thing.

I quit the program and tried again with 1 tiny file that was only 3kb. I figured that would not take that much time.

No second message no result after 20 minutes?

I searched in the folder and in finder and found no recent png files

​What am I not doing? What am I doing wrong?

 

Please help.

I would love to get this to work.

Link to comment
  • 4 months later...
  • 6 months later...

Yay! I've rebuilt this workflow from scratch! I now uses bundled binaries from all the different optimization libraries, all orchestrated by the image_optim library, which is great, since it now longer depends on having ImageOptim, ImageAlpha and more importantly JPEGmini installed! I'll update packal when possible, but right now you can check it out and download it from github: https://github.com/ramiroaraujo/alfred-image-optim-workflow

Link to comment
  • 6 months later...
  • 9 months later...
On 8/28/2015 at 6:31 PM, ramiro.araujo said:

Yay! I've rebuilt this workflow from scratch! I now uses bundled binaries from all the different optimization libraries, all orchestrated by the image_optim library, which is great, since it now longer depends on having ImageOptim, ImageAlpha and more importantly JPEGmini installed! I'll update packal when possible, but right now you can check it out and download it from github: https://github.com/ramiroaraujo/alfred-image-optim-workflow

 

How does this effect JPEG Mini? I have the pro version installed and it looks like it is not used at all - and it's not in the bundle, right?

Link to comment
  • 4 weeks later...
  • 5 months later...

Hi there, thank you very much for this workflow, it saved me from having to use terminal commands to do all of this. You mentioned having a lossless option - is that still in the works? Also - how may I iterate the optimization recursively through subfolders, because I selected a folder with images and folders, which also had images and folders, but the operation only affected the first tier, not the subfolders. 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...