Quickly Resize Images 5

Trick

Share
Quickly Resize Images

Hey

If you ever need to work in design, whether it be web design, Photoshop work, or general image editing. You may need to resize an image. There ain’t many methods which you can do it quickly and easily. I have found two methods, one has an awesome GUI (General User Interface) and the other is more script based.

The first method uses an application called Resize ‘Em All. It appeared in my Top 100 Apps. Resize ‘Em All, gives you the ability to modify the image dimensions, rotation and the format. You can either drag or drop a file onto the drop zone or open them from File > Open.


Once you have opened an image or a group of images you get a range of options for you to apply to the image. This enables you to change the dimensions quickly an easily using the button and the text boxes. If you want to apply this to many images at a time there is a batch menu option in the menu bar. From here you can edit all of the images using the Batching > Edit Images. You can then hit the Batch > Save options to save all the images,


It runs surprisingly quick. Its a simple way to modify a whole range of images at once.

The next option is to use an Apple Script. I don’t use many Apple Scripts but this is one that I use quite regularly. I think I originally found it here. Although I have had it on my system so long I can remember the original source.

Since the script is in text format you have to open this up in Apple Script. Go to Applications > Apple Script > Script Editor. Paste the following into the main pane.

-- save in Script Editor as Application
-- drag files to its icon in Finder

on open some_items
repeat with this_item in some_items
try
rescale_and_save(this_item)
end try
end repeat
end open

to rescale_and_save(this_item)
tell application "Image Events"
launch
set the target_width to 120
-- open the image file
set this_image to open this_item

set typ to this_image's file type

copy dimensions of this_image to {current_width, current_height}
if current_width is greater than current_height then
scale this_image to size target_width
else
-- figure out new height
-- y2 = (y1 * x2) / x1
set the new_height to (current_height * target_width) / current_width
scale this_image to size new_height
end if

tell application "Finder" to set new_item to ¬
(container of this_item as string) & "scaled." & (name of this_item)
save this_image in new_item as typ

end tell
end rescale_and_save

This should appear purple in the text box. Hit the compile button in the toolbar. It will run through the code checking for errors, there shouldn’t be any. The result will be different coloured text based on the syntax.

There are two points in the code that you should be aware of. The first one is the new width of the image. This is represented by the following.

set the target_width to 120

If you want to change the size of the new output you can change this number to any size you want. The next piece of code you should be aware of if the output file name. This is represented by the following line.

(container of this_item as string) & "scaled." & (name of this_item)

The word you need to change is “scaled.” this can be anything you want, I would recommend in keeping it down to one word. The extra dot is added so you can clearly see what the new file is.

The final stage is to save out the script. Go to File > Save and save the script as a script file. Name it “Image Reszie Source” or anything you feel like. This is the source file incase you want to go back and change any of the variables. Then go to File > Save As again and change the file format as Application. This will save the script so that when you drag and drop an image onto it will run. Name this so the file size is in the file name. You can then go back into the code change the image size variable. I have about 5 or 6 files like this all this different sizes.

To run the script select the images you want and drop them onto the application script. The code will run and place the new files in the same folder. It is not as quick as Resize ‘Em but it is simpler.

Hopefully you have followed what I have said, if you have any problems just leave a comment and I will get back to you.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips