ImageMagick: Shrink only larger images

I had a couple of images with different resolutions, ranging from 640x480 up to some 4000x3000 pixels. For the website, I needed them in 1600x1200, so I had to shrink them.

ImageMagick's convert is ideal for resizing many images in a row, and I did it this time again:

$ for i in *.jpg; do resize "$i" -resize 1600x1200 small/"$i"; done

Unfortunately, this also enlargens the smaller images.

The geometry documentation told me to add a larger character > at the end of the final resolution: 1600x1200>.

$ for i in *.jpg; do resize "$i" -resize 1600x1200> small/"$i"; done

With that, only images larger than 1600x1200 got scaled down; the rest were kept as they were.

Written by Christian Weiske.

Comments? Please send an e-mail.