The uber geeks

Exporting photos from iPhoto for use on your web site using Automator

Written by Colin Devroe on Friday, October 6th, 2006 at 9:26 am. Colin is the Technology Evangelist for Viddler.com and lives with his wife and two cats in Childs, Pennsylvania.

I saw that someone was having a little trouble using for what seemed like a relatively simple task. I’m not sure at which point this particular person gave up - but what I think may have happened is that they simply overlooked the fact that 1) Automator allows you to combine many actions for several programs into one workflow, and 2) you can even use scripting languages like AppleScript from within Automator should you get stuck.

We’re not going to need any scripting languages to pull off what this person wants, but is nice to know that you can use just about any scripting language from within Automator to make-up for Automator’s shortcomings.

Here is what the person wanted to do.

  1. Select an album that I want.
  2. Export these photos into 800×600 (or the equivalent aspect ratio) to ~/Desktop/[Album Name]/[original file name].
  3. Export these photos into 120×90 (or the equivalent aspect ratio) to ~/Desktop/[Album Name]/_thumb.[original file name].

The part that stumped me the most is actually using the album name from iPhoto as the name of the Folder. Unfortunately I was unable to get this to work, then again I am not using any scripting in my workflow - so I am guessing that this would be possible if I had.

My Workflow in Automator

My workflow - click to zoom

Details of the workflow (screenshot):

1. Ask for Photos

This action will open up a dialog window that will allow you to select the photos, or entire album, that you’d like to export.

2. New Folder

This is the action that you have to look closely at. The New Folder action, which comes from the Finder group of actions, is not only to make a new folder - it also allows for the input of files to it. Here is how Automator describes the valid input for this action: (Files/Folders) If files are passed into this action they are copied into the new folder.

This action is set to ask you for a folder name, so it will prompt you for that name.

Typically you’d need to run a “Copy Finder Items” at this point since you wouldn’t want to scale your original photos. However the New Folder action does this automatically, which saves us a step. However, this action also “adds” a step.

3. Get Folder Contents

The Automator experts out there may have a better way of handling this, but if I skip this step I am asking Automator to resize a folder name, not the actual files (so the workflow simply does not work properly). With this added action, I push all of the files from within my newly created folder to the next action.

4. Scale Images

This action can be found within the Preview set of actions. It is pretty straight forward in that it resizes your newly exported photos by a specified amount, or by a percentage.

5. Create Thumbnails Images

At first I thought I’d need to run the Copy and Scale actions again in order to create the thumbnails but Automator has an action built in for this. This action will create a thumbnail with any specific suffix added to it, therefore leaving you with two files per original file - one scaled image and one thumbnail of that scaled image.

This workflow could have been extended to uploading the entire folder to my FTP server of choice, but I left that bit out thinking that perhaps someone would want to open the scaled images in Photoshop or, add them to their favorite WYSIWYG editor, etc. Happy exporting!

Want to see this workflow in action, you can download the workflow.

This article has been cross posted from Newsvine, you may read it there if you’d prefer.

Previous and next posts

« New features in Safari 3

Back to the Future Biff sings »

Leave feedback

(required)

(required)

Note: Comments are heavily moderated. If the comment does not add to the above discussion, it will not be approved.

RSS feed for comments on this post. TrackBack URI

Related sites

Recent features

Song of the week

Sara Bareilles - Between the Lines
Sara Bareilles' "Between the Lines" is the Song of the Week for April 20 to 26.

The Deal Log