Hi Everyone,
I recently bought a new camera and found when I attached a photo to an email, it was huge with scroll bars.
I know you can reduce the size in apps like photoshop, but it knew it could also be done with Image Events.
So why wait for an app to open when a script would be faster?
After a quick search for a script I did not find one, so I wrote two myself.
Before posting them to the exchange I figured I would ask you guys to go over them and check them out, I am still new to scripting so I am sure there are things that could be done better than I have done them.
This first one reduces Just one picture
(*
Make Smaller Picture
This script creates a folder on the desktop named "Small Picture" and allows you to select a picture to reduce it size for easy veiwing when attached to an email (no scroll bars).
*)
set thePic to choose file
tell application "Finder"
set smallFolder to make new folder at desktop with properties {name:"Small Picture"}
set smallPic to (duplicate file thePic to smallFolder with replacing) as Unicode text
end tell
tell application "Image Events"
activate
set newImage to (open alias smallPic)
scale newImage to size 700
save newImage in folder "Small Picture" of folder "Desktop" of folder "username" of folder "Users" of startup disk
close newImage
end tell
display dialog "I have finished making the small Image, you will find it in the Folder Small Picture on the desktop"
The second script allows you to reduce multiple pictures.
(*
Make Multiple Smaller Pictures
This script creates a folder on the desktop named "Small Pictures" and allows you to select multiple pictures, from a folder, to reduce them for easy veiwing when attached to an email (no scroll bars).
*)
set picFolder to choose folder
try
tell application "Finder" to set smallFolder to make new folder at desktop with properties {name:"Small Pictures"}
end try
tell application "Finder" to set picList to get (name of files of (entire contents of (picFolder)))
set chooseList to picList
set chosenItems to choose from list chooseList with multiple selections allowed
tell application "Finder" to set newList to every file of (entire contents of (picFolder)) whose name is in the chosenItems
repeat with i from 1 to number of items in newList
set dupFile to (item i of newList) as Unicode text
tell application "Finder"
set smallPic to (duplicate file dupFile to smallFolder with replacing) as Unicode text
end tell
tell application "Image Events"
activate
set newImage to (open alias smallPic)
scale newImage to size 700
save newImage in folder "Small PictureS" of folder "Desktop" of folder "username" of folder "Users" of startup disk
close newImage
end tell
end repeat
display dialog "I have finished making the small copies of the Image's, you will find them in the Folder Small Pictures on the desktop"
Thanks!
Model: MacBook Pro
AppleScript: 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)