#!/bin/sh - # # gif2xpm files... # # This uses the pbmplus package to convert from gif to xpm # This will convert black and white gifs to xbm's automatically # b=" " tmp=/tmp/gif2xpm.$$ trap "rm -f $tmp; exit 0" 1 2 3 15 for i in "$@" ; do echo -n "${b} converting \"$i\" " if [ ! -f "$i" ]; then echo -n "${b}" echo >&2 "Unable find file \"$i\"" continue fi # --- find out the type --- name="`basename $i`" suffix="`expr "$name" : '.*\.\([^.]*\)'`" name="`expr "$name" : '\([^.]*\)'`" j=`basename $i .$suffix` # destination name # case on the standard error on gif filter case "`giftopnm -verbose "$i" 2>&1 >$tmp`" in *PBM*) pbmtoxbm < $tmp | sed 's/noname\([[_]\)/'"$name"'\1/' > "$j".xbm ;; *P?M*) ppmquant 256 2>/dev/null $tmp |\ ppmtoxpm 2>/dev/null | xpm-fix -o "$j".xpm ;; *) echo -n "${b}" echo >&2 "Bad Conversion for \"$i\"" esac done echo "${b}DONE!" rm -f $tmp