Reply to comment

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.

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.