newbie: how to scale and preserve aspect ratio

Monte Goulding monte at sweattechnologies.com
Mon Aug 18 23:40:00 EDT 2003


Hi Rob

********
Can someone point me in the right direction regarding scaling images - - -
my goal is to pull in a JPEG image from an URL and display it in a smaller
size on the screen, no matter what the original size - - - yet preserve it's
aspect ratio.
********

Check out the formattedWidth and formattedHeight properties. The basic
scenario is that you divide your constant width (120) by the formattedWidth
of the image. That gives you a scale factor so you can set the height of the
image:

set the height of image 1 to round(the formattedHeight image 1*(120/the
formattedWidth of image 1))

Cheers

Monte




More information about the use-livecode mailing list