python PIL image how to save image to a buffer so can be used later?
问题 I have a png file which should be convert to jpg and save to gridfs , I use python's PIL lib to load the file and do the converting job, the problem is I want to store the converted image to a MongoDB Gridfs, in the saving procedure, I can't just use the im.save() method. so I use a StringIO to hold the temp file but it don't work. here is the code snippet: #!/usr/bin/env python # -*- coding: utf-8 -*- from PIL import Image from pymongo import MongoClient import gridfs from StringIO import