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.