How to get each pixel value from a picture file!
Steve Holden
steve at holdenweb.com
Mon Oct 23 18:58:21 EDT 2006
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