#! /bin/csh -fe # Last edited on 2008-10-11 11:28:49 by stolfi # Converts a linear-scale ppm file to a gamma-corrected, normalized, # grayscale GIF file, using the gray subset of the standard 6x6x6 colormap. # Set program paths: set maplib = "${STOLFIHOME}/PUB/colormaps" set jslib = "${STOLFIHOME}/lib" foreach d ( "${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin" "/usr/bin" ) if ( -x $d/ppmtogif ) set pbmbin = "$d" end set jsbin = "${STOLFIHOME}/bin/${PLATFORM}" # Option parsing: set scriptname = "$0" set usagetail = "[ < ] INFILE.ppm > OUTFILE.gif " unset transparent source ${jslib}/linear-ppm-to-gif-options.csh if ( $#argv > 1 ) then echo "usage: ${usage}"; exit 1 endif ( ${getimg} $* ; yes ) \ | ${pbmbin}/ppmtopgm \ | ${pbmbin}/pgmnorm -bpercent 2 -wpercent 5 \ | ${jsbin}/ppmvquant \ -fs \ -map ${maplib}/standard-6-graymap-${gammatag}.ppm \ | ${pbmbin}/pnmgamma ${gamma} \ | ${pbmbin}/ppmtogif ${giftropts}