Bulk resize images and change its quality with imagemagick on Linux and Mac OS X

Written by
Date: 2013-01-02 21:17:32 00:00

Even though you can resize image in Mac OS X using Preview.app, I like to install imagemagick, which is the tool I use in Linux.

To install it on a Mac

sudo port install imagemagick

On Ubuntu

sudo apt-get install imagemagick

Then to rezise pictures, and change quality at the same time, use this line.

for i in *; do convert -resize 800x -quality 95 $i prefix-$i; done

That one is going to resize all pictures to 800 width, and the height will be set to any given size in order to keep the aspect ratio. You man also set the height fixed.

for i in *; do convert -resize x600 -quality 95 $i prefix-$i; done

And let imagemagick decide the width to keep the aspect ratio of the picture.