Related link: http://www.apple.com/applescript/imageevents/index.html

Now that I have Panther, I can play around with Image Events. Prior to this, I used Perl to read in an image from my phone, scale it to 320×240, then add a black border around the image.

Now AppleScript makes this really easy. Cobbling together a couple of scripts from the Apple web site, I get the job done in a very Mac like way.

set this_file to choose file

try
	tell application "Image Events"
		launch
		set this_image to open this_file
		scale this_image to size 318
		pad this_image to dimensions {320, 240}
		save this_image with icon
		close this_image
	end tell

on error error_message
	display dialog error_message
end try

Although this script asks me to choose the file through a dialog, Apple also shows examples of automatically choosing every image in a directory, on the desktop, and so on. I want to set up a folder for incoming images for a moblog, then automically run an AppleScript on every new photo before it gets posted to the web.

At some point I also want to use Image Events with watch folder for iPhoto, so when I take screenshots I can automatically convert them from PDF to JPEG. I just wish I could automatically import the images, though.

Still, someone at Apple finally did something did something good for AppleScript.

Do you use image events?