|
From: Panagiotis K. <pko...@gm...> - 2009-12-18 08:06:45
|
Hello matplotlib users! I 'm using matplotlib for one week and I 'm excited. The only thing I couldn't do is to save image's contect straightway to SQL server. So I 'm searching for a function that store figure's image as binary data in a python variable in order to put the content of this variable inside an postgresql query. For example: ....... matplotlib code ......... conn = psycopg2.connect(.......) curs = conn.cursor() image_data=###The matplotlib function I'm searching### sql = "update med_graphs set image=%s;" curs.execute(sql,image_data,)) conn.commit() I found only the figure.savefig() function that saves figure's image only as a filename in the filesystem and not in a local variable. Any help would very much appreciated! Panagiotis |