2 Replies Latest reply on Jun 19, 2007 5:08 AM by James Newton, ACP

    [DIR] Scale a image

    Level 7
      Hello

      it's possible to scale a image with lingo's command?

      I export a image using

      member("x").filename=imagen

      and i need to scale it always to 256x192 pixels

      Thanks


        • 1. Re: [DIR] Scale a image
          Level 7
          Imaging Lingo will do the trick. Look at copyPixels ()

          --
          Craig Wollman
          Lingo Specialist
          Word of Mouth Productions
          212-928-9581

          www.wordofmouthpros.com
          "Tony Angel" <tonyav@hotmail.com> wrote in message
          news:f587bo$2a5$1@forums.macromedia.com...
          > Hello
          >
          > it's possible to scale a image with lingo's command?
          >
          > I export a image using
          >
          > member("x").filename=imagen
          >
          > and i need to scale it always to 256x192 pixels
          >
          > Thanks
          >
          >


          • 2. Re: [DIR] Scale a image
            James Newton, ACP Level 3
            Below is a handler that will return the rect that best fits your target size:

            You could use:

            vTargetRect = rect(0, 0, 256, 192)
            vMember = member("x")
            vSourceRect = vMember.rect
            vImage = vMember.image
            vBestRect = FitToRect(vTargetRect, vSourceRect)

            vScaledImage = image(vTargetRect.width, vTargetRect.height, vImage.depth, vImage.paletteRef)
            vScaledImage.copyPixels(vImage, vBestRect, vSourceRect)

            -- And possibly:
            vMember.image = vScaledImage
            OR
            new(#bitmap).image = vScaledImage