The Mac OS X Automator provides simple, but useful, scripting to automate some commonly used functions. For this entry I’m specifically looking at resizing, renaming and replacing characters for pictures to be uploaded to a website.
Initial Script Setup
I like to start off with making the script prompt me for Finder items, allowing selection of a file, folder or multiple selections:
To add the items selected, to the workflow, we use Get Folder Contents:
The next action, Filter Finder Items, is kind of important. For example, if you received a hundred or so pictures from a client to upload to their website and it came from a PC there more than likely is a .thumb_db file in the folder(s). This would abruptly stop the script from running. To get around this add a Filter Finder Items to the workflow:
This next step is optional, but is useful if you only have one copy of the images. Personally I just duplicate the folder(s) then delete them. Mainly because I haven’t bothered how to prompt where to copy the original files to, this step just copies them into a specified folder but if you’re running the script on multiple folders then all the originals get copied to the same folder.
Resizing Images
By adding a Scale Images action you’re able to resize them by pixels or percentage. I just use the pixel option, and make note that this will resize the highest value (height or width) to the specified value. So, for example, if you have a portrait image, the height will be resized to the value you entered.
Rename and Change Case
Some cameras insist on naming their pictures with uppercase and spaces in the file names. To make them easier for browsers to use, you can change their case and rename them by using the Rename Finder Items action. Below is the Change Case part of this action:
If you want to change case and rename, like changing spaces to underscores, you don’t need another Automator script for it; you can just append another Rename Finder Items but selecting Replace Text instead of Change Case.
And that’s just a couple of very easy Automator Scripts to quickly, and easily, resize, rename and change case on hundreds of pictures in a matter of seconds. I may look into passing variables to the Copy Finder Items action and, if I do, I’ll add that info here as well.