The Mac Tricks and Tips website had a great tip on how to quickly resize multiple images on your Mac using an AppleScript:

Open the Script Editor application (a quick way to do this is by searching for it with Spotlight), then copy the following code into the editor:

-- save in Script Editor as an Application, then
-- drag image files onto the Application's icon
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 file type of this_image
 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

If you want to change the size the output image will have, you need to change this line:

set the target_width to 120

Click the “Compile” button on the toolbar and wait until the purple text color is replaced by blue and green (this indicates that the code compiled without any errors).

Click the File menu and choose Save, then save the script as a script file so you have a copy of the source code. Click the File menu again, choose Save As, and save the script as an Application (you could create a differently named Application from this script for each change you make to the target_width variable in the source code).

To run your new application simply drop an image file on it to have a resized copy of the image created in the folder the application is stored in.

Share this article: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Twitter
  • GatorPeeps
  • Digg
  • Reddit
  • muti.co.za
  • DZone
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Ma.gnolia
  • Slashdot

Related posts:

  1. Bulk convert HTML, RTF, etc. documents to PDF using the Mac OS X command line or an AppleScript
  2. Mac OS X Quick Tip: Launch the screen saver with a bash script using AppleScript
  3. Display Growl notifications from an AppleScript
  4. Change the OS X Network Location from the command line or an AppleScript application
  5. Rearranging any OS X menubar and login items