I need to resize a picture to a fixed size. But it has to keep the factors between the width and height.
Say I want to resize a picture from 238 (w) X 182 (
The technique is to:
Lastly if you are puzzled about how to do the resize math, remember that if proportions of source and destination images are same, this relation holds:
SourceWidth / SourceHeight = DestinationWidth / DestinationHeight
If you know three parameters, you can calculate the fourth one easily.
I wrote an article about this:
Crop-To-Fit an Image Using ASP/PHP