user469652
user469652

Reputation: 51261

Save images as string? IS it possible

Is it possible to save images as string, and then I load it up to Image?

Upvotes: 2

Views: 201

Answers (1)

ars
ars

Reputation: 123518

You can save it to a StringIO buffer:

import pylab, numpy
from StringIO import StringIO
from PIL import Image

# plot a histogram
pylab.hist(numpy.random.rand(100))

buf = StringIO()
pylab.savefig(buf, format='png')

buf.seek(0)
im = Image.open(buf)
im.show()

Upvotes: 6

Related Questions