Re: Resizing image in image events
Re: Resizing image in image events
- Subject: Re: Resizing image in image events
- From: "Gary (Lists)" <email@hidden>
- Date: Fri, 12 May 2006 12:30:03 -0400
"Steve Suranie" wrote:
> Is there a formula
Sure. They even make plastic dial-wheel tools to help with this in the print
biz. I highly recommend having one on the desk. Proportion Wheels is what
they are generally called. (Of course, your father's slide rule is just as
useful, if you have that. :)
> I can use to take any size image greater than 135 pixels
> and resize it down to 135 pixels? For example, if I had images that were 3000,
> 2400 and 1800 pixels in height, I want to resize each so that they are 135
> pixels in height and the width resizes proportionally.
is x%
---- X -----
of 100
135 is what (x)% of 3000
So that's 4.5%.
Now, that's not quite as useful as just finding the _multiplier_ that would
be applied to each value (width and height) to get the new scaled values:
4.5% can be represented as a multiplier of 0.045 (4.5 / 100).
The fastest way, without concern for the logic, is:
135 / _original height_ ==> scale multiplier
135 / 3000 = 0.045
So, an image that starts as:
3000 H by 6250 W
would become:
(3000 x 0.045) H by (6250 x 0.045) W , or...
135 H by 281.25 W
Similarly...
> if I had images that were 3000, 2400 and 1800 in height, I want to resize each
> so that they are 135 pixels in height and the width resizes proportionally.
(I'm making up widths, here.)
Original: 2400 H by 4129 W
135 / 2400 = 0.05625 [ <-- multiplier ]
4129 W x 0.05625 = 232.26 W [ <-- new width ]
Original: 1800 H by 2300 W
135 / 1800 = 0.075 [ <-- multiplier ]
2300 W x 0.075 = 172.5 W [ <-- new width ]
Generalizing to pseudo-code:
[target new height] / [original height] = [scale multiplier]
[original width] x [scale multiplier] = [target new width]
...or...
[target new width] =
[original width] x ( [target new height] / [original height ] )
Of course, you now need to do some rounding to do what you want with
fractional pixels. See the list archive for some excellent rounding
handlers from Kai and Nigel G. (IIRC).
--
Gary
_______________________________________________
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