06-01-2012 01:49 AM
Im in a situation where i need to scale images in terms to the container in which its kept..
Is there any formula to find the scale value that should be applied to the image( I have set the max size of the container)??? Any ideas put forward would be very kind..
Solved! Go to Solution.
06-01-2012 05:05 AM
Welcome to the forum.
I am not sure I understand the issue here.
Say you have an image of height a and width b. You want to scale it to fit in a container of width x and height y. Then the scaling factor that you should use, to make sure the image fills the container as much as possible, without upsetting the aspect ratio is simply
An example, assume your image is 100 x 150 and you want to fit it in an area that 30 x 40
the formula gives:
This, when scaled will fill the entire height, but not the width.
Hope this makes sense.
06-01-2012 05:34 AM
Greatly appreciate your help.
I could scale the image on both height and width by using
Once again thanks a lot.