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.
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