#!/usr/bin/env python import math,sys,commands if len(sys.argv) == 4: try: x = int(sys.argv[1]) y = int(sys.argv[2]) img = sys.argv[3] except: sys.exit("error: x, y must be digits!") else: sys.exit("usage: "+sys.argv[0]+" x y image") foo = commands.getoutput("identify " + img + "|awk \'{print $3}\'") width = foo.split('x')[0] height= foo.split('x')[1] h_winkel=360 v_winkel = (float(height)*float(360))/float(width) ath = (float(x) / float(width) - float(0.5)) * float(h_winkel) atv = (float(y) / float(height) - float(0.5)) * float(v_winkel) print "atv "+str(atv) print "ath "+str(ath)