How to resize and change the resolution of a batch of photos using Automator

I searched for a long time tonight looking for the answer to this (seemingly) simple question:


How do I use Automator to scale and change the resolution of a batch of images?


It was not so simple.


Links to this question:


https://discussions.apple.com/thread/2595412


https://discussions.apple.com/thread/2595540


https://discussions.apple.com/thread/1224327?answerId=5785047022#5785047022


https://discussions.apple.com/thread/234569?answerId=1173358022#1173358022


https://discussions.apple.com/thread/1194576?answerId=5641853022#5641853022


https://discussions.apple.com/thread/661862


These are just the links on this site - I found them all over the place at MacRumors, Apple Tips, Mac Help, etc.


You can actually manage this in Automator.


Here are the steps that worked for me:


  1. Create an Automator APPLICATION - not a workflow (this is due to the way that I'm batch converting images - workflows might be ok for some cases)
  2. Step 1 is Copy Finder Items
    1. My flow inserts an SD card, opens the DCIM folder that my Nikon creates, selecting the images that I click (command + click to multi-select) and once I have the photos highlighted, I drag them onto this Automator App we're creating.
      User uploaded file <== You'll have this guy soon!
    2. As a result - I want to copy the originals to my computer as step 1. I don't touch the originals on the SD card (and cards are cheap so I tend to leave them on the cards as well)
  3. Step 2 is the Scale Images action - you can search the library for this and find it quickly. For my part, I found that scaling images to about 38.8 percent of their size on the SD card is good for uploading to a blog. Change this value to whatever you wish.
  4. Step 3 is Run Shell Script - and here is where we marry the brilliance found at this link with our script.
  5. If you have a hard time reading the text in the image, it is as follows:
    #bin/bash
    for f in "$@"
    do
    /usr/bin/sips -s dpiHeight 72.0 -s dpiWidth 72.0 $f
    done
  6. Save this application (I named mine "Format Photos")
  7. Place the application inside the target folder where you want the images to end up. I do this because when I have the SD card window open, I can also open my "Photos" window and see my App sitting there. I select my images as I mentioned and drag them on top of this app. The app copies the originals and the conversions into the folder.


NOTES: When you open a converted pic in Preview, you will see Resolution = 300 dpi if you go to Tools --> Adjust Size... This reading is explained by another brilliant discussion as sips only touches the JFIF properties inside the file's MetaData. However, if you look at the bottom of the Adjust Size... window, you'll see the image size is probably around 500 kb (give or take depending on the original). My goal was to get the images down from the 3.0 MB I shoot at to around 500 kb. Therefore even though the MetaData still thinks that it is 300 DPI according to Preview, it has been changed to 72 (open it in some other applications mentioned at the links and you'll find different readings - it all depends on what the application reads from the Meta).


This does not rename the files, so you'll get DSC_1000.jpg and DSC_1000 copy.jpg in all likelihood. If that annoys you, add a step into the Automator Application that renames the file after the "Run Shell Script" action has run, and you can have each file renamed according to some convention that you like.


This took a heck of a lot longer than I expected - so I decided to put in the effort to share this with the community and save others the hassle.


User uploaded file

Posted on Aug 13, 2011 6:07 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to resize and change the resolution of a batch of photos using Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.