[reportlab-users] Binary image data in Table

Robin Becker robin at reportlab.com
Fri Jan 19 11:14:58 EST 2007


dimitri pater wrote:

> Hi all,

> perhaps somewhere here can help me...

> The reportlab userguide (page 75) describes how to insert an image (from

> disk) into a table. But I would like to know how to insert an image from a

> MySQL blob field (small thubnails 3Kb) into a table. Is this possible? Any

> ideas?


If you're using the Image flowable then yes. You can copy the data into a
StringIO object. And then reset it.

you need to do something like

from StringIO import StringIO
x = StringIO(data)
x.seek(0)


x now looks like a python file object so you can pass it directly to Image
instead of a file name.
--
Robin Becker


More information about the reportlab-users mailing list