The graphicsmagick package for perl is very extensive but the documentation appears light (or confusing to me) If I have an image and I want to ensure the size is within 800x200 (like https://via.placeholder.com/800x200) while maintaining the aspect ratio of the image, which commands should I use?
In php I have
$tmpImageFile->scaleImage(100,0);
$imageGeometry = $tmpImageFile->getImageGeometry();
$imageHeight = $imageGeometry['height'];
if ( $imageHeight > 100 ) {
$tmpImageFile->scaleImage(0,100);
}
Maybe you could do something like this:
Here I have created an input image "gm.png" :
When running the script I get output:
And the saved output file
out.jpg: