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 target_length to 500
set this_image to open this_item
set typ to this_image's file type
scale this_image to size target_length
tell application "Finder"
set dest to folder "Desktop" of home
set new_item to (dest as string) & "scaled." & (name of this_item)
save this_image in new_item as typ
end tell
end tell
end rescale_and_save