This may sound a little weird, but I'm working on a Perl script that uses Image::Magick to resize an image from its current dimensions, to its new ones.
However, we need to accommodate for silly people, who may put in dimensions that won't fit their image. i.e I want to stop the dimensions making a "squished" or "stretched" image.
Now, FrontPage has a cool function for this - where you just tick the "keep aspect ratio" tickbox in the image properties, and then when you enter your new dimensions - it automatically gives you the correctly proportionate dimensions. For example, an image with
Start image dimensions: width=200 height=218
Desired output: width=150 height=163
Now, the problem doesn't come here - it is when I try and work out the "height" or "width", based on only one parameter being passed in. For example:
Desired output: width=150 height= ???
i.e it needs to work out "height" to the correct pixels (in this case, it should work it out to 163px)
Does anyone know of a function that will do this, or would anyone be able to give me a hand in working out the formula to do this? =)
TIA!
Andy
However, we need to accommodate for silly people, who may put in dimensions that won't fit their image. i.e I want to stop the dimensions making a "squished" or "stretched" image.
Now, FrontPage has a cool function for this - where you just tick the "keep aspect ratio" tickbox in the image properties, and then when you enter your new dimensions - it automatically gives you the correctly proportionate dimensions. For example, an image with
Start image dimensions: width=200 height=218
Desired output: width=150 height=163
Now, the problem doesn't come here - it is when I try and work out the "height" or "width", based on only one parameter being passed in. For example:
Desired output: width=150 height= ???
i.e it needs to work out "height" to the correct pixels (in this case, it should work it out to 163px)
Does anyone know of a function that will do this, or would anyone be able to give me a hand in working out the formula to do this? =)
TIA!
Andy