Imagemagic convert resize and change quality in batch

Written by
Date: 2013-02-15 22:16:13 00:00

If you want to post pictures on your blog, or your site. You may want to change the quality to a lower one, and resize your pictures before.

Today cameras take too big pictures, and they can make your site slow, and you will have to pay for a lot of bandwidth, so you better resize the pictures before publishing them.

Go to the folder where your images are, and enter this command:

find . -name "*.jpg" -exec convert -resize 900x -quality 85% {} {} \;

That will resize them to 900 width and the height will be chosen by imagemagick to keep the weight/height ratio intact. The command will also change the quality to 85% of the original, In the browser you will hardly notice the differences. You may change those number to fit your needs.

Be aware that your files will be replaced, if you prefer to keep the originals.

find . -name "*.jpg" -exec convert -resize 900x -quality 85% {} /tmp/{} \;