#!/bin/sh # # This will try to process each GIF or JPEG file on the command line and make # a small version of it using Netscape colors. Output files are created # in the current working directory. # # edit the FRACTION for a different size # edit "-small." to create different output file names FRACTION=0.2 while [ $# -gt 0 ]; do ftype=`file $1` type=`echo $ftype | awk 'BEGIN{FS=":"}{print $2}'` ext=`echo $1 | awk 'BEGIN{FS="."}{print $NF}'` base=`basename $1 .$ext` echo "$type" case "$type" in *GIF* ) echo "$ftype" giftopnm "$1" | \ pnmscale $FRACTION | \ ppmquant -map /home/ljg/util/netscape-colors.ppm | \ ppmtogif -sort > ${base}-small.${ext} ;; *JPEG* ) echo "$ftype" djpeg -dct float "$1" | \ pnmscale $FRACTION | \ ppmquant -map /home/ljg/util/netscape-colors.ppm | \ cjpeg -quality 80 -optimize -dct float > ${base}-small.${ext} ;; * ) echo "ignoring $1" ;; esac shift done exit