Algoritm for scale an image!
Posted: Tue Jul 13, 2004 10:38 am
Hi!
Does any one know an algoritm to scale an image, by keeping the aspect ratio.
The image has dimension (PWidth, PHeight), and I want to scale it to the dimension (DimWidth, DimHeight).
If the (PWidth, PHeight) are less then (DimWidth, DimHeight) than don't do any scale
otherwise scale the image to (DimWidth, DimHeight).
This meean that the (DimWidth, DimHeigh) are always less then (PWidth, PHeight).
The original image is given as a matrix of pixels.
Bogdan
Does any one know an algoritm to scale an image, by keeping the aspect ratio.
The image has dimension (PWidth, PHeight), and I want to scale it to the dimension (DimWidth, DimHeight).
If the (PWidth, PHeight) are less then (DimWidth, DimHeight) than don't do any scale
otherwise scale the image to (DimWidth, DimHeight).
This meean that the (DimWidth, DimHeigh) are always less then (PWidth, PHeight).
The original image is given as a matrix of pixels.
Bogdan