#!/bin/csh # Written by Bill Brown, to ease making of animated gifs from rgb files. # change these if you want set LOOPS=8 # delay between frames, in 1/100th sec (default 0.5 sec) set DELAY=15 set SNAME=rgb2gifanim if ($#argv < 3) then echo echo USAGE: $SNAME \[-s scalefactor\] animname rgbfile1 rgbfile2... echo exit 1 endif if ($#argv > 1000) then echo echo Too many files to use this script! echo exit 1 endif if ($#argv < 8) then echo echo Too few frames to use this script! echo exit 1 endif set THISDIR=`pwd` set firstfile set num @ num=1 set FSTART="0" if( "$1" == "-s" ) then set SCALE=$2 @ firstfile=4 set MOVIENAME=$3 else set SCALE="1.0" @ firstfile=2 set MOVIENAME=$1 endif foreach i ($*) if ( "$i" == "$argv[$firstfile]" ) then set FSTART="1" endif if ( "$FSTART" != "0" ) then echo $i set SUFFIX=`echo "$num"` if ( $num < 10 ) then set SUFFIX=`echo 00"$num"` else if ( $num < 100 ) then set SUFFIX=`echo 0"$num"` endif set TNAME=t_gif.$SUFFIX.gif imscale $i $THISDIR/$TNAME -scale $SCALE @ num= $num + 1 endif end # add the last one in two extra times for a pause between loops gifmerge -$DELAY -l$LOOPS $THISDIR/t_gif.*.gif $THISDIR/$TNAME $THISDIR/$TNAME > $MOVIENAME.gif # clean up /bin/rm -f $THISDIR/t_gif.*.gif