#!/bin/sh

if [ "$1" = "" ]; then
  FILES=*.pnm
else
  FILES=$*
fi

for FILE in $FILES ; do
  echo $FILE
  NAME=`echo $FILE | awk 'BEGIN{FS=".";}{s=$1; for(i=2;i<=NF-1;i++){s=s "." $i;} print s;}'`

  convert $FILE -threshold 32000 ../png/$NAME.png 
done

exit

