Thursday, November 29, 2007

two way to resize multiple images in linux

There are lot of utility to resize the image.
but most of them are too heavy and even a commercial one.

In linux, anyone can resize multiple images at one command line.

If I have 200 JPG pictures of 3872x2592 (10 Mega pixel) in 'photo' directory and want to resize all the images into 50% size (1936x1296), Choose one of the following methods.

each method use a convert command provided as a part of imagemagick package.
so you have to install imagemagick first.

sudo apt-get install imagemagick.


1. Using shell script.
photo$ for k in $(ls *.JPG); do convert $k -resize 1936x1296 -quality 100 re_$k; done

2. Using find command
photo$find . -name “*.JPG” -exec convert '{}' -resize 1936x1296 -quality 100 re_'{}'\;

No comments: