advertisement

Search


Sponsored Developer Resources

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed


Webloggers
Login
Home




AppleScript Image Events

   Print.Print
Email.Email weblog link
Discuss.Discuss
Blog this.Blog this
brian d foy

brian d foy
May. 15, 2004 11:38 PM
Permalink

Atom feed for this author. RSS 1.0 feed for this author. RSS 2.0 feed for this author.

URL: 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 320x240, 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.

brian d foy is a Perl trainer for Stonehenge Consulting Services and is the publisher of The Perl Review.

Return to weblogs.oreilly.com.



Weblog authors are solely responsible for the content and accuracy of their weblogs, including opinions they express, and O'Reilly Media, Inc., disclaims any and all liabililty for that content, its accuracy, and opinions it may contain.

Creative Commons License This work is licensed under a Creative Commons License.



Sponsored by:



Weblog authors are solely responsible for the content and accuracy of their weblogs, including opinions they express, and O'Reilly Media, Inc. disclaims any and all liability for that content, its accuracy, and opinions it may contain.

For problems or assistance with this site, email