The finished script
The finished script
- Subject: The finished script
- From: Michelle Steiner <email@hidden>
- Date: Mon, 27 Aug 2001 09:03:49 -0700
Here's the finished script for scaling a photo. There are some inherent
assumptions in it:
1. The photo is in the same ratio as 640 by 480 (which is true of almost
all digital cameras)
2. Horizontal photos to be no wider than 640, and all photos to be no
taller than 480.
3. I do not want to enlarge smaller photos.
--Michelle
set the folderToProcess to choose folder
tell application "Finder"
set the photoList to (the files of the folderToProcess)
end tell
repeat with photo in the photoList
tell application "GraphicConverter"
open the photo as alias
set the imageDims to the image dimension of window 1
my setScaleFactor(imageDims)
scale window 1 horizontal scaleFactor vertical scaleFactor
save window 1 as JPEG with wwwready without makeCopy
close window 1
end tell
end repeat
on setScaleFactor(imageDims)
set the scaleFactor to 1
set the horiz to item 1 of the imageDims
set the vert to item 2 of the imageDims
if the horiz is greater than the vert then
if the horiz is greater than 640 then set the scaleFactor to 640 / horiz
else
if the vert is greater than 480 then set the scaleFactor to 480 / vert
end if
return the scaleFactor
end setScaleFactor
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------