Batch Photo Resize with Mac OSX Automator

MacAutomationGuy
I have a constant need to resize photos, often hundreds or even thousands at a time. Additionally, I require that when resizing, I keep the original file separate from the smaller, resized file. There are many ways to resize files on the Mac, but with the advent of file versioning, most of them convert the existing file which I didn’t want.

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.

00
To build our automated workflow, we’re going to use a tool called “Automator” that is included in OSX. We’re going to create what’s called a service which will be available when right-clicking on one or more images.

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. Note that on Catalina the gear icon now called Quick Action but serves the same purpose.

01

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:

02

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.

03

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.

04

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.

05

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:

06
With the selected files now in the Web directory, things get weird. We now need to select all of file we just moved. With the left pane still on “Files & Folders”, double-click on “Get Folder Contents” in the middle pane. You don’t need to do anything in the right pane for this step.

08

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.

09

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.

10

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.

11

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.

12

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.

13

In the right pane choose Change Case, Extensions only, and lowercase.

14

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:

15

With the service saved, it will now appear as a right-click option any time you select one or more photos.

19

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.

20

Here is the final Automator workflow with all of the individual steps collapsed:

WholeScript

 

Congrats! You’re now a programmer. Go ahead and update your resume.

Enjoy your new photo-resizing service!

 

 

More about: [ Guild Guitars ][ Dogs ][ Cozy Tales ][ Ferret-Dog ]

Donate: PayPal Crypto: BTC | ETH | Doge

BTC: bc1qgke2eeuwjafudateev08ekytn3g3mpl2w5a542
ETH: 0x0AC57f8e0A49dc06Ed4f7926d169342ec4FCd461
Doge: DFWpLqMr6QF67t4wRzvTtNd8UDwjGTQBGs

2 thoughts on “Batch Photo Resize with Mac OSX Automator

Leave a Reply to Phil f1hbo Cancel reply

Your email address will not be published. Required fields are marked *