[Image-SIG] question and bug?

Nick Bower nick@nickbower.com
Thu, 07 Dec 2000 17:18:16 GMT

> import Numeric
> import Image

> w =3D 256
> h =3D 256
> im =3D Image.new('P',(w,h))
> for i in range(w):
>     for j in range(h):
>         im.putpixel( (i,j), some_function(i,j) )

> im.show()

this doesn't seem sensible to me at all.  after using numeric arrays to =

do the "some_function", im.putdata(numeric_array.flat) would surely be=20
better, as seen in my earlier post.

nested for loops and individual putpixel's at the python level would be =

much slower than taking advantage of something like putdata which=20
implements the for loop at the C level.  yeah?