Resize images with Automator


Resize images with Automator
Mac Tip #280/14-March-2007

A friend recently complained of tedious amounts of time spent resizing photos and screenshots, which led me to explain how Automator can help. I mentioned Automator back in Automate It, Tip #195/11-May-2005.

I have a Finder folder of photos from my digital camera. In my case, each image is 2 or 3 megabytes, and maybe 3,888*2,952 pixels.

If I want to add some of these to my blog they need to be resized to more like 640*480 pixels and a much smaller file size.

Set up the action

Images selected in the Finder

Images selected in the Finder

Because I only ever work on copies of photos, and never the originals, I first copy the ones I want to resize to another folder and select them.

Click any image in this post to see a larger version.

Set up the Automator workflow

Drag an Automator action to a workflow

Drag an Automator action to a workflow

To resize selected photos open Automator (in the Applications folder). In the Library column on the left select Finder. From the Action column in the middle select ‘Get Selected Finder Items’ and drag the action into the large, empty Workflow area on the right.

Next select Preview in the Library column, and drag ‘Scale Images’ from the Actions column to the Workflow area. Make sure it goes below the ‘Get selected Finder Items’ action: actions occur in the order they appear in the workflow.

A warning lets you choose to copy the images first

A warning lets you choose to copy the images first

When you use ‘Scale Images’ an alert will appear asking if you wish to make a copy of the selected items before you change the image files.

I had already made a copy of my files so I chose ‘Don’t Add’, but ‘Add’ is always a safe choice.

After the ‘Scale Images’ action is added to the Workflow, enter the size in pixels of the desired longer side for your resized photos.

View results is a good check

The results are shown in the Results action

The results are shown in the Results action

The next step is optional, but useful. Select Automator in the Library column, and drag ‘View Results’ from the Actions column to be the last step in the Workflow.

Run the workflow

Finally, click the Run button. Automator resizes all the selected photos and reports the results in the ‘View Results’ area.

The resulting photos

My resized photos have a smaller file size

My resized photos have a smaller file size

The photos have been resized and each is now about 100Kb. This is a larger filesize than a dedicated (and expensive) program such as Photoshop would create, but this is a quick and free action.

Many actions are available

There are many other actions you can use, including changing filenames to lowercase, and opening the images in Preview. Explore Automator’s Actions list to find other actions you may wish to add to your workflow.

Save a workflow

Save the workflow with an expressive name

Save the workflow with an expressive name

If you think you may want to use this workflow again, choose Save from Automator’s File menu and save it to your computer. Tip: make the filename expressive: I called my workflow ‘resize-to-640′. Next time you want to resize a batch of photos in that same way double-click the workflow, select photos in the Finder and click Run in the Automator window.

(Updated December 2010) Download my Resize images workflow here. It’s a 70Kb zipped file, and includes an action to change the filename to lower case: 2010 version MacTips resize images workflow (70Kb zipped file).

Update May 2009: I’ve moved the screenshots to a new location so the thumbnail sized images should be larger.

Update March 2011: Albert Medalla pointed me to a short video he made that shows almost exactly the instructions above. His video is embedded below.

httpvh://www.youtube.com/watch?v=JWeYofqcsN0

Please subscribe to the MacTips channel.

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]

27 Comments

  1. Sonia Helbig said:

    Thanks heaps for your advice! Clear steps and I followed this and used automator to easily resize a header for my blog: http://perthweightloss.com

    You made something people were telling me to buy Photoshop to do into a 5 minute task until I got the resize correct.

    Is there an easy way to use automator to set width for pictures rather than just pixel resize?

    Thanks!

    Sonia

    • Miraz Jordan said:

      So glad this helped you Sonia.

      I’m not sure what you’re asking – in my Tip I show how to set the longest side to be a certain size in pixels, eg 480.

      If you want the width to be 480 and the height to vary then you’ll need to run through your sets of images separately – those that are portrait and those that are landscape to give you more control.

      Does that help?

      Cheers,

      Miraz

  2. Jacob said:

    If you don’t want to deal with the hassle of Automator and just want something that works right out of the box then you should try ImageXY.

    Automator & hacked together scripts are fine for some, but you soon run into trouble when trying to explain stuff like this to your Mom.

  3. ryanchaitram said:

    Thanks man ….

    The step to “get selected finder items” didn’t work for me as automator kept timing out but I understood what you were suggesting so i used “get specified finder items” instead … .thanks for this … this was my first workflow and the instrustions were clear

  4. Mayank said:

    I cannot extract your workflow, sates: unable to unarchive “filename” error 1 – operation not permitted. Something wrong on my end or the file?

    just letting you know.

    • Miraz Jordan said:

      Thanks for letting me know. I’ve just tested it and am also having problems.

      I’ll see if I can sort it out and upload a fresh copy – probably in the next couple of days.

    • Miraz Jordan said:

      I’ve re-created and updated the workflow, and amended the link in the Post above. On testing, it downloaded and expanded correctly for me.

      Thanks so much for pointing out this problem.

  5. Bobby said:

    I’m trying to get Automator (OSX SL) to batch resize my photos which are all in specific folders and sub folders.

    eg: Honda> Honda Civic

    The workflow I constructed is:

    1. Get Specified Finder Items
    2. Get Folder Contents
    3. Scale Images

    In this way, I was hoping I can batch scale my 21,000 photos. However, automator kept popping up a message that says:

    (Image events got an error. Can’t get image “filenameofimage.jpg”. (-1728) )

    And automator will stop after that. It happens randomly, even if I tried doing only one folder at a time.

    However, most of the time if I do it one folder at a time, the second round will then proceed without any problems at all.

    This is driving me nuts knowing I have to manually do folder by folder whenever this random problem comes up.

    Help is very much appreciated.

  6. Bobby said:

    Good day,

    I’m trying to get Automator (OSX SL) to batch resize my photos which are all in specific folders and sub folders.

    eg: Toyota > Toyota Corolla

    The workflow I constructed is:

    1. Get Specified Finder Items
    2. Get Folder Contents
    3. Scale Images

    In this way, I was hoping I can batch scale my 21,000 photos. However, automator kept popping up a message that says:

    Image events got an error. Can’t get image “filenameofimage.jpg”. (-1728)

    And automator will stop after that. It happens randomly, even if I tried doing only one folder at a time.

    However, most of the time if I do it one folder at a time, the second round will then proceed without any problems at all.

    This is driving me nuts knowing I have to manually do folder by folder whenever this random problem comes up.

    Help is very much appreciated.

  7. Miraz said:

    Linda, I can’t see why that would happen, unless you were also using a ColorSync Profile action. Even so, perhaps it’s some problem with the color profile?

    I suggest you try the Apple Support forums for more help.

  8. Linda Puyear said:

    HELP!!! I open Automator; have a folder of tif images pre-sellected selected in folder on desktop; drop the folder onto new Workflow; choose change to jpg as the only action; it happily changes them to jpg but also ruins all of them turning them into green tined, ultra color saturated junk. WHAT IS GOING ON?

  9. Miraz Jordan said:

    Ezit: the answer is in this part of the Tip: “After the ‘Scale Images’ action is added to the Workflow, enter the size in pixels of the desired longer side for your resized photos.”

    You enter the size in pixels you want for the longest side. The action will size the longest side of your image to be that many pixels. The shorter side will be proportionately scaled.

    I don’t think Automator can scale disproportionately. If you want to change the relative proportions I guess you’ll need to use real graphics software.

    You could try opening the image in Apple Preview and use its image editing, scaling and cropping tools.

  10. ezit said:

    Hi, nice article, though it didn’t answer the questions I had when I went googling:
    What does resizing my picture to 640 mean? Does it mean it scales the whole picture until width equals 640, or height equals 640, or what?
    How do I resize something to a more specific size, such as 390 by 749?

  11. Steve said:

    That seems cool. well, for Mac users, i would like to introduce an image resizing tool, which is simple but powerful. It can satisfy all your resizing needs for making wallpaper, for web,etc. If you are a Mac user, that is worth a try.

    • wsblackcat said:

      thanks steve for your image resizing tool,it is so simple but powerful,that is really worth to try for the Mac user!

  12. Pingback: Daily Digest for August 22nd

  13. bakahaido said:

    thanks so much for your help. if not, i would not have known about this awesome software!

  14. Felipe said:

    Hello

    I just switched to mac and I could really use this application. The problem is I cannot get the Finder to show the size of all the pictures at the same time, I have to check it picture by picture. Could you help me…

    Felipe

  15. Lily said:

    Maybe you can help: Today I used the Automator to change pdfs into jpgs. The first time I tried I couldn’t find the files anywhere but the “recent items” of the apple menu so I did it again and had it open in preview. I still cannot find the files anywhere and have now done it three times. I know they exist because I can see them in the recent items and even open them in open recent in Preview. I’ve searched in spotlight for the files by the names shown in preview, by date and manually. I am completely caught up in the mystery of where these files might be and it is driving me crazy. Any suggestions?

  16. Miraz Jordan said:

    Esteban: many thanks for your handy suggestions. It’s cool that the Automator idea can be even more useful.

    Cheers,

    Miraz

  17. Suzanne said:

    Wow! Thank you very much for this explanation. This saves me a lot of time! I sure will start trying to find out what else Automator can do.

    @Esteban, how do you make it a plugin for the finder?

  18. Esteban said:

    thanks, works perfectly.
    i saved the workflow as a plugin for the finder
    so i just gotta right klick the selected images und run the workflow, without starting automator

    thanks

  19. Miraz Jordan said:

    Well, 30 seconds of Googling found this:

    http://www.macosxhints.com/article.php?story=20051020203919140

    “when trying to rename Finder items) I get the following error:

    AppleScript Error: Finder got an error: Can’t get properties of alias “user:path:to:file”. (error -1728)

    It turns out that if you have FileVault enabled, many Automator actions break when you run them.”

    I wonder if that’s your problem?

  20. Alvin said:

    I tried both your workflow and my own to resize pictures but I keep getting the same message:
    Finder got an error: Can’t get file type of alias “Home:Desktop:Outdoor Photos:IMG_2334.JPG”. (-1728)

    I have set the permissions for this folder to enable both read and write but still the same error message.

    How did this error come about and how can i resolve it?

Comments are closed.



Top