|
From: John H. <jdh...@ac...> - 2006-03-27 18:39:15
|
>>>>> "Ken" == Ken McIvor <mc...@ii...> writes:
Ken> imbuf = StringIO() im = Image.fromstring('RGB', (width,
Ken> height), buf, 'raw', 'RGB', 0, 1) im.save(imbuf, 'PNG')
Ken> return imbuf.getvalue()
Note to enterprising mpl users/developers, we should take a look at
the PIL code to see how the effbot does this. I have spent some time
looking into libpng to see how to get it to write to a StringIO
instance. Last time I looked, I couldn't find a way to get a FILE*
out of the stringio instance.... The ability to write to a StringIO
instance is a frequent reqest, and emulating PILs approach would be a
good way to go (and faster than Ken's approach).
JDH
|