[pygtk] Saving and reading images from database

Timo List timomlists at gmail.com
Fri Nov 13 22:15:22 WST 2009


My program uses the SQLite database. The database holds some information
about persons and I want to add a picture for each person. Not the path to
the file, but the actual image so that the image also works if the file is
deleted on the harddisk.

I can save the image in a BLOB column as:
imgfile = open('/path/to/image.png')
db.save_image(imgfile.read())

Works fine as far as I see. (Maybe any comments on this?)

Retrieving also works, but I see no possibility to show this image in a
gtk.Image widget. I can't seem to find anything related to this on the net,
maybe someone reading this has done this before?

Cheers,
Timo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20091113/6e71871b/attachment.htm 


More information about the pygtk mailing list