#! /bin/sh 

OT2GPS=../../ot2gps

rozmer=`identify ${1}_0_0.png | cut -d" " -f3`
x=`echo ${rozmer} | cut -dx -f1`
y=`echo ${rozmer} | cut -dx -f2`

if [ -f ${1}.map ]; then
	${OT2GPS} ${1} ${x} ${y} 0 
fi

if [ -f ${1}.cal ]; then
	if [ -f ${1}.png ]; then
		rozmer=`identify ${1}.png | cut -d" " -f3`
	fi
	if [ -f ${1}.bmp ]; then
		rozmer=`identify ${1}.bmp | cut -d" " -f3`
	fi
	w=`echo ${rozmer} | cut -dx -f1`
	h=`echo ${rozmer} | cut -dx -f2`

 	${OT2GPS} ${1} ${x} ${y} 0 ${w} ${h}
fi

exit 0;


