Python Video processing.
Fredrik Lundh
fredrik at pythonware.com
Tue Jun 13 08:36:09 EDT 2006
"Ant" <antroy at gmail.com> wrote:
> In particular, does anyone know whether the data obtained from decoding
> the video frame as in the following snippet from
> http://pymedia.org/tut/src/dump_video.py.html:
>
> dd= d.convert( fmt )
> img= pygame.image.fromstring( dd.data, dd.size, "RGB" )
>
> can be directly loaded into a PIL Image object (and back again?)?
iirc, the pygame fromstring/tostring methods are designed to be data-compatible
with PIL's corresponding methods, so you should be able to do
im = Image.fromstring("RGB", dd.size, dd.data)
instead of doing that pygame.image call (not that the argument order is different).
for details, see the pygame tostring/fromstring docs, and the corresponding PIL
methods:
http://www.pygame.org/docs/ref/image.html
http://www.pythonware.com/library/pil/handbook/image.htm
hope this helps!
</F>
More information about the Python-list
mailing list