One of the everyday tasks here at TMO is image conversion. We love to bring you informative, helpful, and sometimes humorous images with each article and we draw from many different sources, file formats, and sizes to do so. The only problem is that, in general, our site’s backend requires that images be in JPEG format with a horizontal dimension no larger than 600 pixels.
Batch Resize and Convert with Automator
Therefore, most images we deal with have to be converted from TIFF, GIF, PNG, or any number of other formats and then scaled down to 600 pixels (or less) wide. While we can do this manually in Preview and other image editing applications, the process can be quite tedious if we’re working with multiple images.
Thankfully, Apple’s Automator, one of the most powerful utilities in OS X, allows the creation of a custom application that will do the conversion for us.
First, open Automator from your Applications folder. You will be asked to choose what type of Automator document you’d like to create. Select “Application” and press “Choose.” You’ll now be presented with the primary Automator window.
The Automator window is divided into two primary sections: Actions and Variables on the left and the workflow on the right. In general, building an automator action consists of selecting the variables and actions from the left side columns and then placing them into a sequential order in the workflow process on the right. As we build the workflow, we’re telling Automator, step-by-step, what to do with the files we provide it.
The first step we want Automator to do is to create a folder in which to place our converted images. Select Library > Files & Folders from the first column, and then New Folder from the second column. Drag New Folder and drop it into your workflow on the right. Once the New Folder action is in place, change the “Name” text box to something descriptive of your task. In our case, we’ll call it “Large Image Conversion.” You can also change where on your Mac this folder is created. For now, we’ll leave it set to “Desktop” for easy access.
At this point, Automator will take the images you give it and copy them to this newly created folder. Now we need to instruct Automator to modify the images. Under Library > Files & Folders choose Get Folder Contents and drag it to your workflow below New Folder. This will tell Automator to select the images.
- Now it’s time to actually have Automator modify the images. Under Library > Photos choose Change Type of Images and drag it to the bottom of your workflow. You’ll see a pop-up window asking if you’d like to add a “Copy” function so that the original image will not be altered. This is unnecessary for our purposes because the New Folder action has already made a copy of the original files. Therefore, select “Don’t Add.”
Under the Change Type of Images action, change the “To Type” drop down to your preferred image type. In our case, we’ll choose JPEG. This will take all the images you’ve added to the Automator action and convert them to JPEG.
Next, we need to resize the images to meet our 600 pixel requirement. This step is optional if all you need to do is convert images to a different format. Under Library > Photos choose Scale Images and drag it to the bottom of your workflow. As in Step 5, Automator will ask you if you’d like to add a “Copy” action. Select “Don’t Add.” Then, select “To Size (Pixels)” and enter your desired pixel size for the largest dimension. In our case, that’s 600 pixels.
- Finally, save your Automator workflow by choosing File > Save and giving it an applicable name. In our case, we’ll call it “Convert & Resize.” Once you’ve saved the application, locate it in Finder and drag it to your Dock for easy access.
- Now it’s time to put Automator to work. Select as many images as you want to convert and drag and drop them on to the Automator’s Dock icon. Depending on the number and size of images and the speed of your Mac, within a few seconds to a few minutes, a new folder will be created on your Desktop, filled with copies of all of your selected images, with each one converted to JPEG and scaled to a maximum dimension of 600 pixels.
Keep in mind that this workflow will resize all images to 600 pixels, even those that are smaller, resulting in potentially pixelated images. As powerful as Automator is, it does not have the ability to process files on a conditional basis. However, you can use AppleScript to write a conditional image resize task and then insert that AppleScript into your Automator workflow in lieu of the Scale Images action. Alternatively, you can create a separate Automator workflow that omits the resize component entirely and use that to convert your smaller images.
Regardless, taking a few minutes to set up an Automator action can save hours of manual converting and manipulation in the long run.
Teaser graphic via Shutterstock