#! /bin/bash # Shell script to resize JPG files # Gowtham, 26 July 2004 # # This makes a list of all JPEG files # Modify the extension to pick other type of images export JPEG_LIST=`find . -iname "*.jpg" | sort` # ImageMagick's convert utility export CONVERT="/usr/bin/convert" # Width of resized images # Modify the value to meet requirements and make sure # that the original images are larger than this size. export WIDTH="640" # If the directory called 'resized' does not exist, # resize the images and put them in that folder. # If such a folder already exists, then quit without # resizing images. if [ ! -d ./resized ] then mkdir ./resized for x in $JPEG_LIST do echo "Working on $x" $CONVERT $x -sample $WIDTH resized/$x done echo else echo "A directory called 'resized' already exists" echo "Check its contents, rename it if need be and" echo "run this script later." echo exit fi