Resize images to specific height value in ImageMagick?

Solution 1:

According to the documentation of ImageMagick I suggest to use -geometry x600, whereas x600 means that the new image has a heigth of 600 px with the same aspect ratio as the old image.


For a single image you could run:

convert input.png -geometry x600 output.png

If you prefer to convert all images of a folder in one run, switch to it (i.e. cd ~/Pictures/panoramas/) and use

mogrify -geometry x600 *.png

But be careful with that, because it overwrites the original image files. To avoid that you could

  1. create a new folder (mkdir ~/Pictures/panoramas/small)
  2. copy the images into this folder (cp ~/Pictures/panoramas/*.png ~/Pictures/panoramas/small) and
  3. edit the images in this new folder (cd ~/Pictures/panoramas/small && mogrify -geometry x600 *.png).

Solution 2:

to resize all files in a folder, can use something like

mogrify -resize 800x1094! *jpg # keep image aspect ratio

--- change size and extension as suitable