Resize Images in AppleScript
I really like Dr. Drang’s method of using sips for manipulating images. I set out to modify my FTP macro to include an image resize step. After a short bit of playing around I discovered that it’s very easy to manipulate images right in AppleScript. In fact, Apple provides services to add the necessary code to a script just by selecting the variable that points to an image.
Here’s the script:
tell application "Finder"
set this_item to get selection
set myPath to POSIX path of (this_item as text)
end tell
tell application "Image Events"
set this_image to open myPath
scale this_image to size 550
save this_image in myPath
close this_image
end tell
Here’s how easy it is. The first couple of lines just get the finder selection and places the path in a variable. Select that variable and right click.
Select the “Resize” script as shown. A window will pop-up asking for the desired size. That’s about it. Apple has made this very easy.