[Image-SIG] Low level access
James Shuttleworth
csx239@coventry.ac.uk
Wed, 10 Jul 2002 16:05:49 +0100
Hi,
I've just been playing with the PIL and I'm quite impressed. It's my f=
irst=20
use of python, so I've been having lots of fun. I do have a question=20
though...
I've been writing a tool that alters an image based on the content of ano=
ther. =20
The first way I tried it, I hust used getpixel and putpixel. This worked=
=20
fine, but it was very very slow. I speeded things up a little (actually,=
I=20
doubled the speed) by using getdata to retrieve the pixel info from the t=
wo=20
files. What I then wanted to do was to remove the use of putpixel. Firs=
t I=20
thought I'd use getdata to get an object of the right size and then alter=
it=20
for the new image, but I can't (it's immutable?). Is there any way to=20
quickly manipulate the image data at the pixel level? I've been using th=
e=20
fromstring method to speed things up a little (creating a list and then=20
joining it to create the string rather than using concatenation), but it'=
s=20
hardly a big improvement.
Am I going about this in the wrong way? Is PIL the right tool for the jo=
b? =20
It's taking around 23s per image pair, which is just too slow. Ideally, =
this=20
is intended for frame by frame compositing of rendered movie passes.
Any ideas?
Thanks,
James
csx239@cov.ac.uk