#!/bin/bash # Scales a jpeg image provided in the first argument and stores it in the second argument. # If provided, the third and fourth arguments indicate (x,y) size in pixels. xsize=100 ysize=150 if [ $# != 2 ] && [ $# != 4 ] then echo "need two or four arguments" exit 1 fi if [ $# == 4 ] then xsize=$3 ysize=$4 fi djpeg < $1 | pamscale -xysize $xsize $ysize | cjpeg > $2