Bulk Image Resizing with I

I was recently tasked with resizing a large group of images to post online. The original images were to large both in file size (to long to download over dial up) and physical size (images went of the edge of screens).

To do this I went to my trusty command line and used www.imagemagick.org. Image Magick comes with the wonderful convert tool. Using convert I have made jpg’s into gifs and mtiff’s into gif’s. But I have never used to resize and compress before. Lucky me there is a huge list of options. I even thought about watermarking the images (copyright info) using convert but decided against it.

To start I figured out how to resize then how to compress. The final command line option I came up with was:

convert input.jpg -resize 50% -quality 50 output.jpg

I then proceed to do this in a shell script, which took a few minutes to run, but still hours faster than I could ever do with photoshop or the GIMP.

#!/bin/bash
for x in `ls`
do
   IMG=`echo $x | awk -F. '{print $1}'`
   echo $IMG
   convert $IMG.JPG -resize 50% -quality 50 ${IMG}_bp.jpg
done

Now there is a bunch of resized images ready in minutes. The input images were all of form FILENAME.JPG the output were all the form FILENAME_bp.jpg

Questions about hosting images should go to brockp@mlds-networks.com.
The images can be found at the: Michigan Jersey Cattle Club

NONE, NADA, ZIP, ZILCH

Why don't you pony up and be the first to add your comment?

Add your own comment...

plants