Hello. Using PIL 1.1.5, I am trying to do logical ands on bitmap
images using ImageChops.logical_and. I seem to always get completely
black images instead, however.
Here's a simple testcase:
"""
import Image, ImageChops, ImageDraw
im1 = Image.new("1", (50, 50))
im2 = im1.copy()
im3 = im1.copy()
draw1 = ImageDraw.Draw(im1)
draw1.rectangle([0, 0, 40, 40], fill=255)
draw2 = ImageDraw.Draw(im2)
draw2.rectangle([10, 10, 50, 50], fill=255)
im1.show()
im2.show()
# this doesn't work:
ImageChops.logical_and(im1, im2).show()
# I expect it to work like this:
im3.putdata([x1 & x2 for x1, x2 in zip(im1.getdata(), im2.getdata())])
im3.show()
# this does work:
ImageChops.logical_or(im1, im2).show()
"""
Is there another way to perform a logical and operation?
Thank you,
--
Michael Hoffman
_______________________________________________
Image-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/image-sig