[Image-SIG] reading image from database

Ivan bdfy at mail.ru
Tue Apr 6 11:37:50 CEST 2010


I want to use PIL library for crop image on the fly. In my python script:

cursor = connection.cursor()
cursor.execute("SELECT file from table");
row = cursor.fetchone();
filetype = imghdr.what(0,row[0]);
mimetype = 'image/' + filetype;
response = HttpResponse(row[0],mimetype = mimetype );

How to correct use PIL library for read image to Image object and return image after crop ?



More information about the Image-SIG mailing list