Re: Easy PIL question

2008-02-16 Thread Gary Herron
Adam W. wrote: I know there is an easy way to do this, but I can't figure it out, how do I get the color of a pixel? I used the ImageGrab method and I want to get the color of a specific pixel in that image. If you know how to make it only grab that pixel, that would also be helpful.

Re: Easy PIL question

2008-02-16 Thread bearophileHUGS
Gary Herron: Try image.getpixel((x,y)) to retrieve the pixel at (x,y). If the OP needs to access many pixels, then he can use the load() method on the image object, and then read/write pixels (tuples of 3 ints) using getitem [] import Image im = Image img = im.load() img[x,y] = ... ... =

Re: Easy PIL Question?

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I want to do something very simple: I want to read a palette image (256 color PNG or BMP for instance), and then just to output the image data as numbers (palette indexes, I guess). it's explained in the documentation, of course:

Re: Easy PIL Question?

2006-10-30 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: it's explained in the documentation, of course: http://effbot.org/imagingbook/image.htm#Image.getdata But as I read it, this gives me pixel values, i.e. colors. I want palette indexes instead (which is what is really stored in a palette image). I guess I can make a