#! /bin/csh -f -e

# makes an icon for a simple .gif povray output

set fn = "$1"
set name = ${fn:t}
set dir = ${fn:h}
echo "gif-to-icon dir = $dir name = $name"
cd $dir

set gif = ${name}.gif
set ppm = /tmp/$$-${name}.ppm
set icon = ${name}-icon.gif

rm -f ${icon} {p,q}.{gif,ppm} 
rm -f {p,q}-*.{gif,ppm} 
nice cat ${gif} | giftopnm | pnmgamma 0.555555 > ${ppm}
ls -l ${ppm}
nice linear-ppm-to-scaled-gif -ysize 050 ${ppm} > ${icon}
ln -s ${gif} p.gif
ln -s ${icon} p-icon.gif
rm ${ppm}
