471,342 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

PyCairo, PIL and StringIO

I'm doing some image processing in PIL, and I want to
display the results in a GTK window using PyCairo, so
I create a Cairo image surface from the PIL Image like
this:

mfile = StringIO.StringIO()
final.save(mfile, format="PNG")
ima =
cairo.ImageSurface.create_from_png(mfile)
mfile.close()
return ima

Where final is a PIL image. The problem is, I get a
IOError: error while reading from Input Stream.

¿Any idea of why is this happening? I tried saving to
a temporary file, i.e., replace the above code with:

final.save('final.png')
ima =
cairo.ImageSurface.create_from_png('final.png')

Instead of a StringIO object, and it works just fine.
__________________________________________________ __________________________________
¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
http://correo.yahoo.com.mx/
Jan 2 '08 #1
0 1273

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Thomas Lotze | last post: by
5 posts views Thread by Leif K-Brooks | last post: by
1 post views Thread by Clark C. Evans | last post: by
21 posts views Thread by Paul Rubin | last post: by
3 posts views Thread by Max | last post: by
2 posts views Thread by Jonathan Bowlas | last post: by
reply views Thread by Jim | last post: by
3 posts views Thread by bob | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.