[Image-SIG] loading PIL image to pygame without the need to write a temporary image file

Jelle Feringa / EZCT Architecture & Design Research jelle.feringa at ezct.net
Sat May 7 12:27:18 CEST 2005


I'm working on a script where I blend frames according to their visual
So if there's not too much difference, you'll have a swift fade-in, if the
difference between the two frames is greater, the fade-in will last longer.
Simple idea, but very effective, so cool to be able to do that kind of thing
< 15 minutes in PIL & python.

I'm using this sequence to write directly to mpeg2 output, and that's where
things mess up.
I use PyMedia (worth checking out!) to encode to mpeg2 files.
My guess was that pilmage.tostring() would be quite similar to pygame's 
pygame.image.tostring(img, "RGB") function. That unfortuanately isn't the

When I use the PIL function to encode to a string, the program crashes after
a couple of frames, and works fine with the pygame string function. Since I
use a PIL blend method to get the magic done, I'm trying to find a way to
load the image into pygame without needing to write a temporary image file.

And that's where I'm left clueless. 
I'm fairly new to python, and this is the kind of thing that still gets me
So I hope to be able to learn from someone's experience facing a similar



More information about the Image-SIG mailing list