12:06 pm

MacMost Now 781: Using Automator to Resize Images

With Automator you can create your own application that will resize any image dropped onto it. In this example it will create a new file, name the file appropriately, and resize the image in that file. You can use this for a single image or to batch process several images.

Video Transcript (Click to Expand)
Hi this is Gary with MacMost Now. On today's episode let's use Automator to create a handy app that will automatically convert an image to a smaller size.

So we are going to run Automator. In Automator we are going to choose an application. We are going to make something that we can drag and drop a file onto and that would be an Application. We are going to choose that and then we are going to use the actions over here in the Library to create something that will take, if I were to drag and drop onto the app and create another copy of it that's a smaller size. That is constrained to a smaller size. It may be a better size for emailing or uploading to social media websites.

Now let's make a plan first. What we want to do is not to actually alter the original image. We want to make a copy of it and then we want to alter that. We also want the copy to be named correctly. So there is actually three things that we want to do.

First is to duplicate the file. The second is to rename it so that it has a name that we want. Because we know if we duplicate something in the Finder we just get space and the word copy after the name. Then we want to actually scale it.

So we can use the Library over here to narrow down things or we can simply just search for them. So let's search for duplicate and we see we get Duplicate Finder Items. So let's go and drag that over here. You can see it is going to take the files and folders as input to the app and then it is going to make a duplicate copy of it. So, so far so good.

So next we want to take the result of this, which would be the files that have been created, and rename them. So we can see Rename Finder Items. Let's drag and drop that underneath here and it warns us that it is going to change the name so would we like to make a copy of them. We don't want to. We have already duplicated the files. So we are going to go in here and you can see it is going to default add date and time which isn't what we want to do. Fortunately there is a set of options here and we are going to Replace Text. We know that the text that we want to replace is the space copy in the basename before the dot and extension. We want to replace that with something like -small.

Now so far it will duplicate the Finder item. It will change the name from say image space copy.jpeg to image (dash) -small.jpeg.

Finally we want to scale the result here. So let's look for scale. We can see there is a Scale Images. We can drag that here. We don't want to add the duplication again because we already did that. We can scale two sides or Percentage. So percentage will shrink the image. But what we really want to do is to scale to a size. We want to make sure that it's 640 wide or tall, whichever one would be larger. For any of these you can always look at the Options and things in the description to find out more about what it is exactly going to do. So you have Options there.

So now we have this complete set here. We have duplicated the file, replace the copy in the name with -small, and it will scale the image so it is no larger than 640 pixels on any side.

Now we are going to Save. We have already selected Applications so it is going to save it as an App. So we will do Resize Image.app and it will save it here on the desktop and you can see saved here as an application.

So now I have moved the app and also an image into this folder called Resize. So I can test it out. Now I'm going to take this photo here and we can see that this photo is actually quite large. It is, down here, 2048 x 1536. We are going to drag and drop it on the Resize Image App and we can see that it creates this file here. You can actually see it do the steps if you look really quickly. It appends the -small to it. It leaves the file extension unchanged and the rest of the name there unchanged and we can see that if we get info on this that it is 640 x 480 now.

Now the cool thing about this app is that it takes whatever you throw into it. I can throw in four different photos here. So I have four photos. I am going to drag and drop them to the app. You can see it is going to duplicate all four of them, change the file name for all four of them, and it will resize them. So now I can look and say here is the original size for this one, more than 3000 pixels across and the small version is 640 across. You can even see the file sizes significantly different here. So you can actually batch change files using the same app that we have just made.

So I hope this script is useful but I also hope that it gives some insight on how you can use Automator to do something that you needed to do.

Until next time this is Gary with MacMost Now.

Comments: 20 Responses to “MacMost Now 781: Using Automator to Resize Images”

    JG Francoeur
    11/1/12 @ 9:19 am

    I wish I could get more info on how to use Automator. Seems useful but no clue how to use/configure it… Anyone?

    JG Francoeur
    Author, Messy Manager

      11/1/12 @ 9:22 am

      Well, there is the video on this page :)
      And some others here at MacMost (http://macmost.com/tag/automator)
      Not sure what you mean by “configure it” — it is just a tool that you can use for various things. Of course most Mac users never use it, or need to use it.

      Rich O
      11/2/12 @ 6:20 pm

      Automator seems daunting at first, but stick with it. Just take some time and play around with it. It wasn’t long before I created Apps and Services (Services appear in “services” in the context menu). I am very particular about the photos I take. I like them named a certain way and I like to have a scaled web version. I created an app that simply renames, one that scales and renames. I even created an app that can reduce the file size of a PDF while retaining sufficient image quality.

      I learned from Gary here, practice, and trial & error. But once you got it, these tools are always with you. You will be thankful you invested the time to created tiny applications that do just what you need instead of launching a much larger app, or buying someone else’s app that basically does the same thing.

      Happy Automating.

    Paddy zoller
    11/1/12 @ 11:48 am

    This intro to Automator is great. Thanks for including this video. I always thought it would be beyond my scope of expertise. Now I can go forth with more confidence and discover what other uses it will have for me.

    Oliver Schwarz
    11/1/12 @ 12:29 pm

    Hey, Gary, thanks for this useful app! Thanks for your great tutorials!

    richard perrier
    11/1/12 @ 1:22 pm

    gary , i’ve save to desktop but now at 3:14 i’m not sure what you click to get 3:16 window i’m stuck there
    perhaps i’m missing a bar

      11/1/12 @ 5:01 pm

      From 3:14 to 3:16 I simply quit out of Automator. I put the app that was created, plus a sample image, in a folder. So I am just looking at a Finder window that shows a folder with the created app and a sample jpg file.

    richard perrier
    11/1/12 @ 1:31 pm

    i would like to reduce in size my initial logo in order to insert into a text edit document or email.

    Nilesh Parmar
    11/1/12 @ 3:25 pm

    I use Automator as much as possible in my daily work life. This tip is great, especially when the photo/image is resized by the longest width, thank you.

    I find changing pc files from _ (underscore) and lowercase to Title Case and space to replace the underscore a godsend, my clients always send underscored silly title files. lol. Nice tip!

    Joseph Allen
    11/2/12 @ 3:59 am

    How do you edit an app … ??? Let’s say you want to change the SCALE from 680 to 300; do have have to create a 2nd app using 300 or can you modify the 680 app like the one you just created … ???

      11/2/12 @ 8:25 am

      You can just open the app in Automator and change the number.

        Joseph Allen
        11/2/12 @ 7:22 pm

        Thanks, Gary. You da man … !!!!!!

    11/2/12 @ 5:42 am

    Great video Gary. Very helpful. Thanks!

    11/3/12 @ 1:13 pm

    Thanks Gary. It is so much fun to learn something new about my Mac. This is so easy now to email photos and post to the web is paste too.

    My transition to Mac has been a delight thanks to all your videos. Keep em coming.

    Gavin Brooker
    11/6/12 @ 3:11 am

    Hi Gary – thanks as always for these Brilliant “How To” videos – they are so helpful. I’d never even opened automator before as I had no idea what it did!!

    The app works brilliantly! :o) – 2 questions – 1. Is it possible to get it to create a new folder on the desk top and put the scaled images in the folder – I’ve been playing around with it and cant get it to do them – so I guess im not giving it the right command … and 2) Is it possible to get the scaling app to sit in the dock at the bottom / side of the screen – as when I move it there – and drop a picture on it – a little gear appears in the tool bar at the top of the screen – but nothing happens ?

      11/6/12 @ 7:32 am

      The problem with trying to get it to create a new folder is that you are asking it to do two things. The input comes in to the script (which files to convert) and then you take a detour and say “create a folder.” So the input from the script gets lost because you are not using it.
      So you would have to store the input, then create a new folder, then recall the input, then do the conversion. It takes this from a beginner script to an advanced one.
      I would just create a folder manually that sits in your Documents or Pictures folder. Then have the results always go there. That would make more sense for a beginner script.
      As for the Dock, it should work there, yes.

    11/8/12 @ 4:42 pm

    Thanks Gary great video.
    I have done the same thing but I created a service rather than an app and gave it a name like “shrink photo” when I clicked on the quit and save option.
    Then you just right click on any photo and the context menu has the option to shrink the photo it works identical to yours.
    You can play around with finder function options so you are only looking for photos this means if you right click on a document you do not get the menu but right click on an image and you do.
    Automator is awesome.

    11/17/12 @ 3:54 am

    Hi Gary,
    Thanks for great vid! I used automator to convert a pdf of a book to an rtf file but it removes the pictures and text formatting.

    Is it possible to convert a doc with pictures and formatting intact using automator?

    PS: More automator & Pixelmator videos would be great!

      11/17/12 @ 9:15 am

      Not sure as I have never tried. If you have Microsoft Word installed, then it comes with a ton of Automator commands. One is the ability to “Save As” and an rtf file is indeed an option.
      Of course Word also has its own internal macros language which is pretty deep.

Comments Closed.