I've looked around for this, and can't find an easily implemented solution.
Currently I'm working on an application that deals with panoramas. As they come out of the batch stitch process, the dimensions average 18000x4000. Using ImageMagick, how can I downscale those images to a specific height value while maintaining aspect ratio?
According to the manual, the convert
operation takes in both height and width to resize to while maintaining the same aspect ratio. What I'd like is to put in 600 and 1000 in my existing resize script function and have both a regular viewable image as well as a reduced size.
According to the documentation of ImageMagick I suggest to use
-geometry x600
, whereasx600
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:
If you prefer to convert all images of a folder in one run, switch to it (i.e.
cd ~/Pictures/panoramas/
) and useBut be careful with that, because it overwrites the original image files. To avoid that you could
mkdir ~/Pictures/panoramas/small
)cp ~/Pictures/panoramas/*.png ~/Pictures/panoramas/small
) andcd ~/Pictures/panoramas/small && mogrify -geometry x600 *.png
).to resize all files in a folder, can use something like
--- change size and extension as suitable