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
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
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