2009/4/1 santosh panda <santosh...@yahoo.co.in>: > Dear List members, > > I am a beginner in Python programming, I want to write a python script which > would take 1 band .tiff raster image as input, then calculate the > reflectance value for each pixel using the following equation > [refl] = (pi * ((((lmax - lmin) / 255) * [filename]) > + lmin) * d^2 ) / (esun * COS((90 - elevation) * .017453293)) > and write the output to a raster file.
You could use PIL's ImageMath module: >>> from PIL import Image, ImageMath, math >>> im = Image.open("input.tif") >>> out = ImageMath.eval("... expr ...", dict(im=im, lmax=..., pi=math.pi)) >>> out.save("output.tif") (see the handbook for details) or, alternatively, especially if you want to do more extensive calculations, numpy. Are elevation, esun etc constant for the whole image, btw? </F> _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig