My requirements were simple: Resize a directory or selection of photos, all to the same size (1600 pixels on the longest side), placing the resized photos into a subdirectory called, “Web” while leaving the originals untouched. I wanted this specific set of steps because I had previously been using a wonderful Windows program called Thumbnailer that let me do just that. Thumbnailer was the only program that I still needed Windows for, and I desperately wanted to stop using Windows, so I came up with this Automator script which is much simpler to use. Here’s how you can make one just like it.
Step Zero – Open Automator. He’s the little robot dude in your application folder that looks like he’s holding a bazooka. You can see him at the top of this article.
When you first open Automator it will ask you to choose a document type. You want Service which is the icon that looks like a gear.
You should how have an empty Automator page. Automator is laid out such that there are categories of tools in the left pain, a list of the tools within that category in the middle pane, and the automator steps for your workflow in the right. When you drag or double-click a task n the middle pane, it will be added to the right pane.
If you make a mistake and add the wrong thing, just click the little x in the item in the right pane and it will go away. Let’s get started building our workflow.
First we need to tell the workflow to create a new subfolder called Web. On the left pane choose, Files & Folders. In the middle pane find the option for New Folder and double click it. You should see a new item in the right pane with the name New Folder. In the Name field, change the name to Web. It should look like this:
Now we’re going to create a temporary variable that will be used in a bit. Click the Utilities item in the left pane, then double-click Set Value of Variable in the middle pane. This will add another item in the right pane.
In the right pane, click on pull-down that says New variable… and change the name to WebDir. The name here doesn’t really matter in the end since it’s a temporary variable but we will need to reference it later on so if you make it something different, remember what it is! Trust me – just make it WebDir. If you’re curious, the contents of this variable is the name of the folder we just created – namely Web. Click the Done button when finished.
Next, in the left pane click on Files & Folders, then in the middle pane double click on Filter Folder Items. Make sure the pull-downs in the right pane say All, Kind, is, and image. This will allow the workflow to only work on images.
Next we want to copy all of the selected image files into the Web subfolder (which is stored in the variable WebDir). The left pane should still be in Files & Folders. If not, choose that. In the middle pane double-click Copy Finder Items. In the right pane in the bottom right there is a section entitled “Variable”. Click and drag the “WebDir” fom that lower right pane into the upper-right pane and over the drop-down to the right of “To:”. It should look like this when you’re done:
Now, we will resize all of the images in the Web subfolder. In the left pane click Photos. In the middle pane double click Scale Images. This will cause a pop-up that asks if you want to add a copy of the original image. Click on Don’t Add since we already made a copy and we’re resizing the copies.
With that out of the way, you now have a default image scale size of 480. Change it to 1600 (or if you prefer a different size, enter the longest side size in pixels. In other words if you want 800×600 (assuming a 4:3 image), then enter 800.
With the images resized we’re now going to rename the resized images by appending _1600 (or whatever you’d like) to the file name. In the left pane click Files & Folders. In the middle pane double click Rename Finder Items. This will cause another pop-up asking if you want to add a copy. Click Don’t Add because, again, we’re already working on the copies.
With that pop-up out of the way, make sure the new item is set to Add Text, then change the Add: field to _1600 or whatever suffix makes sense. If you set your images longest side to 800, then _800 would make more sense. You could also just name it something like _web, or if you’re making thumbnails, something like _thumb. Make sure the example looks right to you and adjust accordingly if it does not.
Finally, having multiple images with varying suffix cases like .JPG and .jpg drives me nuts, so I convert them all to lower case. If this doesn’t matter to you, you can skip this step.
With the left pane still on Files & Folders, double click Rename Finder Items again. Yes, we are doing this step twice. The first time renamed the base file name to filename_1600. This step makes all the suffixes consistent. In other words if some of your files are file.jpg and some are file2.JPG, this will convert them both so that the extension will be .jpg (in lower case). When you get the pop-up, choose Don’t Add.
In the right pane choose Change Case, Extensions only, and lowercase.
Hooray – we’re done! Now you need to save your Workflow Service. I call mine Make Web Subfolder. Choose File, Save, from the top line menu, then name your service:
With the service saved, it will now appear as a right-click option any time you select one or more photos.
By choosing this, the service will create the Web subfolder, copy the selected images over, convert them to the new size, rename them, and convert the extensions to lower case.
Here is the final Automator workflow with all of the individual steps collapsed:
Congrats! You’re now a programmer. Go ahead and update your resume.
Enjoy your new photo-resizing service!