Re: Math-a-magic puzzle
Re: Math-a-magic puzzle
- Subject: Re: Math-a-magic puzzle
- From: "Mark J. Reed" <email@hidden>
- Date: Sun, 1 Aug 2010 12:59:08 -0400
On Sun, Aug 1, 2010 at 11:59 AM, email@hidden <email@hidden> wrote:
> After giving this some more thought, this is, I think, a better solution.
> When working with graphics it's always better to scale down. If you scale
> up, you're adding information, and the first solution I posted was scaling
> up on images that didn't round to a width of 500 pixels.
Exactly. If you are ever forced to do more than one scaling
operation, you want to scale up first and down last. Never scale down
on the way to scaling up, because that irretrievably loses
information. (Scaling up on the way to scaling down introduces noise
that might change the final outcome, but it's better than throwing
away information).
But scaling should always be reducible to a single operation.
> set image dimension of window 1 to {500, round (500 / (picWidth / picHeight))}
I would use the expression (picHeight * 500 / picWidth) to avoid a
division - multiplication is computationally cheaper and doesn't
introduce rounding errors. And you avoid a set of parentheses. :)
set image dimension of window 1 to { 500, round (picHeight * 500 / picWidth) }
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden