Use Automator to Convert and Resize Image Files
Posted on by Kirk McElhearn
One of the little known tools available in macOS that can save you lots of time is Automator. This app allows you to create workflows, which you can use to — as its name suggests — automate certain tasks on your Mac.
If you’re familiar with AppleScript, you might want to think of Automator as being like AppleScript without the need to write any code. You don’t have to know any commands; Automator shows you which commands — or actions — are available, and you can drag and drop them to create routines. You can then run these routines in the Automator app, as services via a contextual menu, or in applets that you can save and run by double-clicking or by dragging and dropping files on them.
In this article, I’m going to introduce you to Automator, and I’m going to show you how to quickly and easily create two applets: one converts image files into a pre-determined format, and the other resizes images to a pre-determined size. Here’s how to start working with Automator.
Getting to Know Automator
The Automator app is located in your /Applications/Utilities folder. Launch it, and you see an open dialog. To create a new Automator workflow, click New Document. You’ll see this:
Automator can create a number of different types of documents, including:
- Workflows can be run from within the Automator app.
- Applications can be run by double-clicking, or by dragging and dropping files on their icons.
- Services are activated from the Services menu in apps that support this technology.
- Print Plugins are available from the Print dialog in any app.
- Folder Actions can run when automatically when you add items to folders you attach them to.
- Calendar Alarms run when an event triggers them in the Calendar app.
- Image Capture Plugins run inside the Image Capture app, that you can use to scan documents or import images from a camera, SD card, or iPhone.
- Dictation Commands run when you use macOS’s Dictation feature, and say a specific phrase.
The most useful of these are, for most people, services and applications. The term workflow best describes what you create within the Automator app, even if you save it as something else. I’ll use that term in the rest of this article to discuss what I’m creating, even though I’ll explain how to create an application.
Creating an Image Conversion Application
If you take photos, you may want to share them to your website or to an online gallery. If your images are not in JPEG format, you may need to export them from an image editing app, or you may need to convert them. If you do this often, you may find it easier to use your original images and convert them en masse. This Automator workflow will allow you to do that. Simply drag and drop images on its icon, and it converts them in a flash.
Since this is most useful as an application — on which you can drag and drop files — let’s start by creating a new application. In the dialog you see in the first screenshot above, click Application, then click Choose. Automator shows you a library of apps and actions on the left, and an empty area on the right. This right-hand section is where you will build your workflow.
Whenever you create an application, it can work by default with drag and drop. You drag one or more items on the applet’s icon, rather than having to select items in an Open dialog. Automator tells you that this workflow receives files and folders as input.
Next, we want to find an action that will convert image files. Click Photos in the Library column, then find the Change Type of Images action.
(You’ll see in my screenshot that there are two versions of this action; one with the iPhotos icon, another with the Acorn icon. Acorn is an image editor that I have on my Mac. Some apps provide Automator actions that leverage the features of their apps.)
When you select an action in the Library columns, a section at the bottom left explains what these actions do. For the Change Type of Images action, it tells you what type of images the action can receive.
Drag the Change Type of Images to the right.
When you add this action, Automator will tell you that it will replace the images you use as input, and ask if you want to add a Copy Finder Items action to keep the originals. I’m going to go ahead without this, but you may want to do this so you have both your original images and their conversions.
You have five choices for the output this action generates. Click the To Type menu and choose what you want; I chose JPEG for this example.
You should now save your workflow. Press Command-S, give it a name, and make sure you save it as an Application.
Now, find a file in one of the formats this workflow can accept; it can be BMP, GIF, JPEG 2000, PDF, PNG, or TIFF. (It can accept JPEGs as well, but it will just convert them to the same format.) Drag the image on the applet’s icon, and you’ll almost immediately see that your image has converted.
Creating an Image Resizing Service
You saw above how easy it is to create an application; now, I’m going to create a service. This type of workflow is accessible from the Finder’s contextual menu when you right-click on one or more items.
Create a new document in Automator, but choose Service. At the top of the right hand pane, choose Service receives selected image files in Finder.
Next, in the Photos section of the Library column, choose Scale images. You can tell Automator how to scale the images: either by a number of pixels for the longer side, or by a percentage. If, for example, you want to scale images to 1000px, enter that in the text field.
Save the workflow; press Command-S and choose a name for it. You won’t choose a location, because Automator saves it in the appropriate folder for services.
Go to the Finder and select an image file. Right click, and you’ll see, at the bottom of the menu, the service that you’ve just saved. Select that menu item, and the service runs, scaling your image.
You’ve seen that Automator can be very easy to use, and can save you a lot of time. In future articles, I’ll look at some of the other neat things you can do with this app to make working with files and folders quicker and easier.
New to macOS? Learn tips and tricks at Intego’s New Mac User Center!Want to get the most out of your new MacBook, iMac or other Apple computer? Whether this is your first laptop or you’ve just switched from Windows, there are a few things you should know about your new Mac, like basic keyboard shortcuts or how to use the various features macOS has to offer. Learn more about what your Mac computer can do for you at the Intego New Mac User Center: Get started now!