#!/bin/sh
#
# converts a png to a xpm
# uses netpbm
#
# 18. Januar 2002
# Diether Knof

if [ $# == 0 ]; then
  > image.png
  file="image.png"
elif [ $# == 1 ]; then
  file=$1
else
  echo "Please give no more than one filename"
  exit 0;
fi

pngtopnm -alpha ${file} \
	> mask.pbm
pngtopnm ${file} \
	| ppmtoxpm -alphamask=mask.pbm

rm mask.pbm
if [ $# == 0 ]; then
  rm ${file}
fi