Hi mpl users, I am trying to save a figure to a file like object (a StringIO object) and load this object into PIL (Python Imaging Library). The code for this is really simple (fig is my figure object):
# This works fig.savefig('test.png', format='png') im = Image.open('test.png') # This fails imgdata = StringIO.StringIO() fig.savefig(imgdata, format='png') im = Image.open(imgdata) File "/home/jl/testfile.py", line 551, in contour im = Image.open(imgdata) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1916, in open raise IOError("cannot identify image file") IOError: cannot identify image file Does anyone know what I am doing wrong? I would really like to avoid putting the image on disk before opening it in PIL since I am using the code in a web application where speed is important. Best regards, Jesper ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users