Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize an image to a certain height in ImageMagick 7?

Tags:

imagemagick

I need to resize an image and the result image should have 300 pixels in height. The image must keep the aspect ratio of the original image.

like image 718
BearCode Avatar asked Sep 19 '25 01:09

BearCode


1 Answers

To specify the height and keep the aspect ratio, use -resize x300

magick in.jpg -resize x300 out.jpg

For more ways to specify the target size, see https://imagemagick.org/Usage/resize/#resize

like image 105
L. Scott Johnson Avatar answered Sep 23 '25 06:09

L. Scott Johnson