#!/bin/sh
#
# rotates the xpm-image
# uses netpbm
#
# 23. Januar 2002
# Diether Knof


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

xpmtoppm --alphaout=- ${file} \
	| pnmflip -rotate90 \
	> mask.pbm
xpmtoppm ${file} \
	| pnmflip -rotate90 \
	| ppmtoxpm -alphamask=mask.pbm \
	2> /dev/null

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