[Image-SIG] question and bug?

Mike Coleman mcoleman2@kc.rr.com
Wed, 6 Dec 2000 02:14:35 -0600 (CST)


I was playing with the Image module, and have a question and maybe see a bug.
The question is, is there any way to set individual pixels?  That is, I'd like
to compute a channel as a function of two other channels.  Is this possible?

The bug appears with the code below when the images are 'show'ed.  The
displayed images do look approximately correct, but there is a strange chunk
artifact going on.  That is, the image looks like it were assembled from
individual squares, about 16x16 pixels I'm guessing.  There is no such
artifact in the source, that I can see.  Is this supposed to work?


import Image
import ImageChops

im = Image.open("/tmp/peppers.jpg")
print im.size
print im.mode

out = im.point(lambda x: x * 0.5)

r, g, b = im.split()

dgr = ImageChops.subtract(r, g, 1, 128)



im2 = Image.merge("RGB", (dgr, dgr, dgr))