[PIL] about the difference between pudata and putpixel
Hillairet Julien
jh at nospam.com
Sun Aug 29 14:23:53 EDT 2004
Le Sun, 29 Aug 2004 07:37:37 -0700, Kylotan a écrit :
> 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))
Yes that's it !!
I've not understood that Image need an 1D array...
Thanks a lot.
More information about the Python-list
mailing list