#! /bin/csh -fe # Last edited on 2008-10-11 11:29:36 by stolfi # Converts a pair of linear-scale ppm files, generated # with black and white backgrounds, respectively, # to a gamma-corrected, transparent-background GIF file # unsing the standard 6x6x6 colormap. # The output is sent to stdout. # Program paths: set maplib = "${STOLFIHOME}/PUB/colormaps" set jsbin = "${STOLFIHOME}/bin/${PLATFORM}" set jslib = "${STOLFIHOME}/lib" foreach d ( "${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin" "/usr/bin" ) if ( -x $d/ppmtogif ) set pbmbin = "$d" end # Option parsing: set scriptname = "$0" set usagetail = "BLACKFILE.ppm WHITEFILE.ppm > OUTFILE.gif" set transparent source ${jslib}/linear-ppm-to-gif-options.csh if ( $#argv != 2 ) then echo "usage: ${usage}" exit 1 endif set blackppm = "$1" set whiteppm = "$2" set blacktmp = "/tmp/$$-0.ppm" set whitetmp = "/tmp/$$-1.ppm" ${getimg} ${blackppm} > ${blacktmp} ${getimg} ${whiteppm} > ${whitetmp} ${jsbin}/ppmoquant \ -fs ${ppmtropts} \ -map "${maplib}/standard-6x6x6-colormap-${gammatag}.ppm" \ "${blacktmp}" "${whitetmp}" \ | ${pbmbin}/pnmgamma ${gamma} \ | ${pbmbin}/ppmtogif ${giftropts} /bin/rm ${blacktmp} ${whitetmp}