#! /bin/csh -f set usage = "$0 [ -test ] [ -show ] DIRECTORY " # Creates all standard scaled and gamma-corrected GIF versions # of a square logo, from its PPM version. # # The script assums that either "DIRECTORY/p.ppm" exists, # or both "DIRECTORY/p-0.ppm" and "DIRECTORY/p-1.ppm" exist. # # In the first case, "DIRECTORY/p.ppm" will be converted to # a set of opaque ".gif" files. # # In the second case, the two images must have generated against # a black and a white background, respectively; they will be converted # to a set of transparent-background "GIF" files. # # In either case, one ".gif" will be produced for each standard "logo" # size: 025x025, 035x035, and their power-of-two magnifications, up to 400x400. # # The input PPM file(s) should have 1x1 aspect, with linear intensity scale. # For best results, their size should be 400x400 or more. # # This script expects to find these files # # DIRECTORY/p.ppm base image (if not transparent) # DIRECTORY/p-0.ppm black-bg base image (if transparent) # DIRECTORY/p-1.ppm white-bg base image (if transparent) # DIRECTORY/p.comments short description of logo. # # The following files may be present in place of (or in addition to) # the ".ppm" files above: # # DIRECTORY/p-raw.ppm uncorrected image (if not transparent) # DIRECTORY/p-0-raw.ppm black-bg uncorrected image (if transparent) # DIRECTORY/p-1-raw.ppm white-bg uncorrected image (if transparent) # # In that case there must also exist the file # # DIRECTORY/p.parms the color correction parameters. # # The script will then automatically (re)create IMG.ppm from IMG-raw.ppm # by applying the color correction described in p.parms, # if IMG.ppm is either missing or obsolete; where IMG is # either "p", "p-0", or "p-1". # # In any case, the PPM files may be compressed with "compress" or "gzip". # # The script will then create # # DIRECTORY/p-025x025.gif GIF version of logo, 25 by 25 pixels. # DIRECTORY/p-035x035.gif GIF version of logo, 35 by 35 pixels. # ... # DIRECTORY/p-400x400.gif GIF version of logo, 400 by 400 pixels. # # DIRECTORY/p.gif a symbolic link to "p-400x400.gif" # DIRECTORY/p-icon.gif a symbolic link to "p-050x050.gif" # # DIRECTORY/p.html-inc an html fragment, for make-image-index # # The "-test" switch asks to create only one GIF version (with size 200x200). # In that case, "p.gif" and "p.-icon.gif" will be links to that same file. # # The "-show" switch displays the input and output files, using "xv". # Program paths: set toolbin = "$0"; set toolbin = "${toolbin:h}" set path = ( /usr/local/bin /usr/bin /usr/ucb ) # Option parsing: unset testing set mkgifopts = ( ) while ( ( $#argv > 0 ) && ( "x$1" =~ x-* ) ) if ( ( $#argv >= 1 ) && ( "x$1" == "x-test" ) ) then set testing shift else if ( ( $#argv >= 1 ) && ( "x$1" == "x-show" ) ) then set mkgifopts = ( ${mkgifopts} "-show" ) shift else echo "usage: ${usage}" ; exit 1 endif end if ( $#argv != 1 ) then echo "usage: ${usage}" ; exit 1 endif set dir = "$1"; shift; if ( $?testing ) then set sizes = ( "140x140" ) else set sizes = ( \ "070x070" \ "025x025" \ "035x035" \ "050x050" \ "100x100" \ "140x140" \ "200x200" \ "280x280" \ "400x400" \ ) endif ${mkgifs} ${mkgifopts} ${dir} ${sizes}