• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Math-a-magic puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Math-a-magic puzzle
      • From: "email@hidden" <email@hidden>
References: 
 >Re: Math-a-magic puzzle (From: Luther Fuller <email@hidden>)
 >Re: Math-a-magic puzzle (From: Robert Poland <email@hidden>)
 >Re: Math-a-magic puzzle (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Math-a-magic puzzle
  • Next by Date: Re: Math-a-magic puzzle
  • Previous by thread: Re: Math-a-magic puzzle
  • Next by thread: Re: Math-a-magic puzzle
  • Index(es):
    • Date
    • Thread