i use mongodb and save file to gridfs
now i want edit images from gridfs ...
i use this code
def thumbnail(file_obj):
import StringIO
from PIL import Image
im = StringIO.StringIO()
im开发者_StackOverflow中文版.write(file_obj.raw_file)
im_ful = Image.open(im)
return im_ful.info
but pil said "cannot identify image file"
thats image also ;) how can fix it
You need an im.seek(0)
before the Image.open(im)
call. Otherwise PIL tries to read from the end of the file, gets no data, and fails.
精彩评论