in reply to HTML image resizing with Image::Info based on max height/width

You might be interested in Image::Math::Constrain

Update:  Example:

#!/usr/bin/perl use Image::Math::Constrain; my $math = Image::Math::Constrain->new(800, 600); my ($width, $height, $scale) = $math->constrain(1123, 1243); printf "new width = %.4f\n", $width; printf "new height = %.4f\n\n", $height; printf "old aspect ratio = %.4f\n", 1123 / 1243; printf "new aspect ratio = %.4f\n", $width / $height; # same as old
  • Comment on Re: HTML image resizing with Image::Info based on max height/width
  • Download Code