#!/bin/bash # These dirs MUST ALREADY exist or it'll crap out # Source directory, this is where you place the images you want to smallify srcImageDir="/tmp/image" # Destination directory, this is where I'll place the resulting images destImageDir="/tmp/image/small" # navigate to the src dir cd $srcImageDir # first convert any tif's to jpg for i in *.tif; do j=`echo $i | sed -e 's/\.tif/\.jpg/'` convert $i $j done for i in *.jpg; do convert -scale 30% $i $destImageDir/$i done # go back where we started cd -