[PIL] about the difference between pudata and putpixel

Kylotan kylotan at hotmail.com
Sun Aug 29 10:37:37 EDT 2004


Hillairet Julien <jh at nospam.com> wrote in message news:<pan.2004.08.29.10.54.40.204024 at nospam.com>...

> Although, this code doesn't work:
> 
> im.putdata(color)
> 
> There is no error message, but the image's pixels stay black (0) ! (The
> color matrix is not an 0-matrix !)
> 
> Is someone can explain me my misunderstanding of putdata ?

I think the misunderstanding is of numarray. I'm guessing that
iterating through a 2D array returns individual rows rather than
individual elements.

I've never used numarray before but from looking at the documentation,
you could try this:

im.putdata(color.ravel())

or 

im.putdata(ravel(color))


-- 
Ben Sizer



More information about the Python-list mailing list