Andrew Chamberlain wrote:
>  The reason I ask is because I'm trying to calculate a
> ratio image between two bands in an RGB image, and was hoping the 
> ImageMath module in 1.1.5 might be able to help.

If speed does not matter much, something like this should work:

im = Image.open('some rgb image')
im2 = Image.new('L', im.size)
SCALE = 128

ratios = [min(int(SCALE * r / (g + 0.01)), 255)
           for r, g, b in im.getdata()]

im2.putdata(ratios)
im2.save('/tmp/ratio.png')



douglas

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to