How to resize images in batch using ImageMagick and bash

I have taken a lot of pictures while I have been in Australia. In order to save time and bandwidth when I upload them to my site I have been resizing them to 800x600 from their normal 2536x1536 resolution. This reduces size per image from 1.4 MB to ~200 KB.

To do this if your images are in ~/Pictures and you want to put the resized images in ~/Pictures/resized you can use a simple for loop like the following with the 'convert' command from the ImageMagick suite

Assuming you are already in ~/Pictures/ run the following:

for i in `ls *.jpg | xargs`; do convert $i -resize 800x600 ~/Pictures/resized/$i-resized.jpg; done;

If your original file was named original.jpg it will now be named original.jpg-resized.jpg

There is probably a way to make that output file name cleaner but I haven't looked into it yet.