How to get each pixel value from a picture file!

Lucas Luwian at gmail.com
Tue Oct 24 01:14:49 CEST 2006


:)

1)I just copy the tutorial to run "print pix[44,55]". I really dont
know why they wrote that?!


2) i think putpixel((44, 55), (0, 0, 0)) and putpixel((44,55),0) is
same.

thank you  again. I think I have solved my problem.

Steve Holden wrote:
> Lucas wrote:
> > Thank you for your answer.
> >
> > I have some new questions:
> >
> > 1)  the value of return from getpixel() is a RGB number?
> >          print im.getpixel((44,55))   ----> (160,160,160)
> >
> Yes, that's an RGB tuple.
>
> > 2) I want to put a number into the picture for encryption(replace least
> > significant bit (LSB) of image intensity with message bit).
> >
> >     If i use putpixel((44,55),0) , the number 0 will be changed RGB
> > value or others.?
> >
> I think you'd need to use
>
>      putpixel((44, 55), (0, 0, 0))
>
> but it's easy enough to try out interactively ...
>
> > 3)         pix = im.load()
> >             print pix[44,55]
> >             pix[44, 55] = value
> >  my python cannt identify "[x,y]" ??
> >
>
> Now what makes you think that an image can be addressed that way? I'd be
> quite surprised if yo got anything other than a TypeError doing that.
>
> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb       http://holdenweb.blogspot.com
> Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list