On Tue, Aug 17, 2010 at 10:59 AM, Lutz <[email protected]> wrote: > Hi, > > I wan't to return an generated PIL object with Werkzeug just like an > normal image. So if I call an URL like www.mydomain.de/img/12345.png I > can see the image in the browser. > > My try without success: > @expose('/img/<pic>') > def showimage(request, pic): > from StringIO import StringIO > image = StringIO() > my_PIL_Object.save(image, format='png') > > return BaseResponse(wrap_file(request.environ, image), > mimetype='image/png') >
Try seeking back to the beginning of the file before returning it in the response: image.seek(0) -steve -- You received this message because you are subscribed to the Google Groups "pocoo-libs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pocoo-libs?hl=en.
