Re: Resizing image in image events
Re: Resizing image in image events
- Subject: Re: Resizing image in image events
- From: kai <email@hidden>
- Date: Sat, 13 May 2006 00:49:36 +0100
On 12 May 2006, at 18:47, Michelle Steiner wrote:
On May 12, 2006, at 10:34 AM, Peter Waibel wrote:
Try to use the "to size" option for the scale command:
scale: Scale an image
scale reference -- the object for the command
[by factor real] -- scale using a scalefactor
[to size integer] -- scale using a max width/length
But what does that integer represent? Height, width, both, the
longer dimension, the shorter dimension, or something else?
It's the longer dimension, in pixels, Michelle. So a routine that
scales an image to a height of 135 pixels might use the command like
this:
--------
set f to choose file of type {"public.image"} without invisibles
tell application "Finder" to set {name:n, name extension:e, folder:l}
to f
tell (count e) to if it > 0 then set {n, e} to {n's text 1 thru -(it
+ 2), "." & e}
set p to POSIX path of (choose file name default name n & " [scaled]"
& e default location l as alias)
tell application "Image Events"
close images
tell (open f)
set {w, h} to dimensions
if w > h then
scale to size w * 135 / h as integer
else
scale to size 135
end if
save in p
close
end tell
end tell
--------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden