[Tutor] RGB, images

Goldie, Josh josh.goldie at mirant.com
Wed May 11 15:04:07 CEST 2005


Try using getdata() on the Image:

im = Image.open("oxygen.png")
im.load()
d = im.getdata()
print list(d)

That will give you a list of the form:
[(r,g,b,a), (r,g,b,a)... ]

Where r=red, g=green, b=blue, and a=alpha.  When r==g==b, you have a
gray pixel.
 

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of Alberto Troiano
Sent: Tuesday, May 10, 2005 7:09 PM
To: denise.hartley at gmail.com
Cc: tutor at python.org
Subject: Re: [Tutor] RGB, images

Hey

Can you be a little more specific on how to get certain part of the
image to analyze?????
I managed to split it in all its bands (though I don't know what is
that) How can I work only with the gray part??????

Thanks

Alberto

>From: "D. Hartley" <denise.hartley at gmail.com>
>Reply-To: "D. Hartley" <denise.hartley at gmail.com>
>To: Python tutor <tutor at python.org>
>Subject: [Tutor] RGB, images
>Date: Tue, 10 May 2005 14:08:32 -0700
>
> > A shade of gray is made by having r == g == b.
>
>... so this has nothing to do with masks and transparency?
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor


Gaucho


_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list