Fredrick, Douglas, All, I have Pil : Image.VERSION: '1.1.6a0-20051002'.
I finally managed to have this useful pixel function work fine. I don't understand why it did not work before. Maybe I was still in Python 2.4 and PIL 1.1.5 ??? (I have 2 python and 2 PIL on my PC). The important thing is that it now works. Thank you Fredrick and also many thanks to Douglas S. Blank for your swift replies. Dom ----- Original Message ----- From: "Fredrik Lundh" <[EMAIL PROTECTED]> To: <image-sig@python.org> Sent: Saturday, June 24, 2006 5:14 PM Subject: Re: [Image-SIG] Help on accessing pixels values > bestdomdom wrote: > >> First please forgive me for asking such a basic question but I am a >> newbie >> to Python, to programming and I am alone with my IT worries. >> I would like to access pixels values in order to make some computations >> but >> with the 1.1.6 PIL, I don't understand. >> As an example, here is what I do: >> >> import Image >> im = Image.open("myimage.jpg") >> pixel=im.load() >> print pixel [0,0] # to see the value of pixel[0,0] >> x=(0,0,0) #black in RGB >> pixel[0,0]=x # to set the first pixel in black >> >> This gives me an error : "TypeError: unsubscriptable object". >> I believe I am doing something wrong ;( > > are you sure you have PIL 1.1.6 ? what does > > >>> import Image > >>> Image.VERSION > > print ? > > </F> > > > _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig