S
S. D. Rose
I have a question about PIL.
I get a 50k photo from a MySQL table, convert it to grey-scale, do some
rotations, etc. Then I want to put it back. It seems that after I do the
greyscale, it converts from 'JPEG' to 'RAW'. Can anyone tell me how I
convert the image back to 'JPEG' and then insert the photo into the MySQL
database? I've tried .tostring('jpeg') but that told me it couldn't load the
jpeg encoder.
My steps are here:
IOError: encoder JPEG not available.
Any help telling me how to take the bwImg image (not the PIL object) and
placing it back into a MySQL database would be highly appreciated!
Thanks!
Dave
I get a 50k photo from a MySQL table, convert it to grey-scale, do some
rotations, etc. Then I want to put it back. It seems that after I do the
greyscale, it converts from 'JPEG' to 'RAW'. Can anyone tell me how I
convert the image back to 'JPEG' and then insert the photo into the MySQL
database? I've tried .tostring('jpeg') but that told me it couldn't load the
jpeg encoder.
My steps are here:
TRACEBACK ...'JPEG'import MySQLdb
import array, cStringIO
import Image, ImageOps
con = MySQLdb(db='', host='', user='', passwd='')
cur = con.cursor()
cur.execute('SELECT photo FROM photos')
result = cur.fetchone()
photo = result[0].tostring()
colorImg = Image.open(cStringIO.StringIO( photo))
colorImg.show() # Shows a color image on the Win32 screen
img.format
IOError: encoder JPEG not available.
Any help telling me how to take the bwImg image (not the PIL object) and
placing it back into a MySQL database would be highly appreciated!
Thanks!
Dave