Thursday, July 17, 2008

Batch Image Resize on Linux

Isn't it the same case always. You go out on a trip somewhere. You become trigger happy and click loads of pictures. You come back and want to share it with friends and need to upload them to either picassa or flickr. Now typically if you use a 6 plus MPixel camera, the pictures generally come out to around 1.7MB in size. Uploading a lot of such pictures is a big pain.

I recently discovered the convert utility on Linux. Using it is pretty simple. Here is a small script that I use to batch resize my pictures before uploading them:

for file in *.JPG;
do echo "Resizing file $file ...";
convert -resize 640x480 $file $file ;
done

Check out some pics (Portland visit for RailsConf) that were uploaded after the conversion above here.

No comments: