#! /bin/csh -fe # Converts linear-scale ppm files to gamma-corrected GIF files # unsing the standard Microsoft 16-color palette. # The gamma is 1.8, which seems OK for Sun Xterms. # # The COLOR parameter should be in a format recognized by pnmtogif(1) # Currently "R,G,B" is OK, where R, G, and B are floats in [0_1] # These values are assumed to have been gamma-corrected by the caller set usage = "$0 [ -transparent COLOR ] [ PPMFILE ]" # grab the "transparent color" option: unset bgcolor if ( $#argv > 0 ) then if ( "x$1" == "x-transparent" ) then if ( $#argv < 2 ) then echo "usage: ${usage}" exit 1 endif set bgcolor = "$2" shift; shift endif endif if ( $#argv > 1 ) then echo "usage: ${usage}" exit 1 endif if ( $?bgcolor ) then cat $* \ | ppmvquant -fs -rgb -map ${STOLFIHOME}/lib/standard-16-linear-colormap.ppm \ | pnmgamma 1.8 \ | ppmtogif -transparent "${bgcolor}" else cat $* \ | ppmvquant -fs -rgb -map ${STOLFIHOME}/lib/standard-16-linear-colormap.ppm \ | pnmgamma 1.8 \ | ppmtogif endif