fiximg 616 Bytes
#!/bin/csh

# set echo

set imgname = $1
set xmult   = $2

set sizes=`imgsize $imgname`

@ sx = $sizes[1]

@ tx = $sx + $xmult - 1
@ tx = $tx / $xmult
@ tx = $tx * $xmult

if ($tx > 32) then 
@ tx = 32 
endif

@ sy = $sizes[2]

@ ty = $sy + $xmult - 1
@ ty = $ty / $xmult
@ ty = $ty * $xmult

if ($ty > 32) then 
@ ty = 32 
endif

echo -n Scale in X by " "
echo $tx / $sx |  bc -l

echo -n Scale in Y by " "
echo $ty / $sy |  bc -l

imscale -bilinear -xsize $tx -ysize $ty -infile $imgname -outfile Resize$imgname

mv Resize$imgname $imgname

# izoom $imgname Resize$imgname `echo $tx / $sx |  bc -l` 1.0 -t -w 0.1