#! /bin/bash
read -p "convert to color or gray ? " answer
for img in $(find . -maxdepth 1 -type f -iname "*png")
do
	name=$(echo $img | sed 's:^\./\([a-zA-Z0-9_].*\)\..*:\1:g')
	echo $name
	if [ $answer = g ]
	then
		#convert to grayscale images
		convert $img -set colorspace Gray -separate -average $name.png
	else
		#only format 
		convert $img $name.eps 
	fi
done
