Random thoughts shooting out of volatile mind
Resizing Large photos in Linux
Last week Sunday went for small hiking with my collegues around Karkala my home town. We took around  350 odd photos with a 12MP camera. Each picture was about 1MB with resolution more than 3000pixels. I was trying to resize all these photos and Aravinda pointed me to image magick tool convert. But I had a problem here all picture names were in this format Picture xxx.jpg , space in the file name was causing problem. After searching for a while came accross rename command to rename the files by removing space in the file name. Here is how you do it
rename "s/ *//g" *.jpg
This renamed all the files to Picturexxx.jpg (here the xxx is a number). Next I used the following script to resize all the files at a time without loosing the quality

#!/bin/bash
for i in `ls *jpg`
do
convert -resize 700 -quality 100% "$i" "$i"
done

Well I'm happy now I saved a lot of space on my HDD and also uploaded photos easily to my picasa web albums. This is the reason why I like Linux more. It always comes with many amazing tools and you don't have to pay a penny for it.
Posted by: copyninja on Saturday, 26 December 2009

blog comments powered by Disqus
Fork me on GitHub