Re: [Matplotlib-users] savefig to StringIO and import into PIL

2008-10-23 Thread Jesper Larsen
Hi Michael, 2008/10/22 Michael Droettboom <[EMAIL PROTECTED]>: > You need to "rewind" the StringIO cursor before opening with PIL: > > imgdata = StringIO.StringIO() > fig.savefig(imgdata, format='png') > imgdata.seek(0) > im = Image.open(imgdata) Thanks. It works fine now. Best regards, Jesper

Re: [Matplotlib-users] savefig to StringIO and import into PIL

2008-10-22 Thread Michael Droettboom
Jesper Larsen wrote: > 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 = I

[Matplotlib-users] savefig to StringIO and import into PIL

2008-10-22 Thread Jesper Larsen
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 i