Very useful! I need this myself. Thanks Massimo
On Jul 11, 5:42 am, Tim Michelsen <[email protected]> wrote: > mdipierro: > > > You can do it like in django: > > > from PIL import Image > > def image(): > > image = Image.new("RGB", (800, 600)) > > response.headers['Content-Type']="image/png" > > image.save(response.body, "PNG") > > return response.body.getvalue() > > > response.body is a StringIO > > Here is a matplotlib based version: > > # CONTROLLER: > > def image_mat(): > import sys > import matplotlib > matplotlib.use('Agg') > from pylab import plot, savefig > plot([1,2,3]) > response.headers['Content-Type']="image/png" > savefig(response.body) > > return response.body.getvalue() > > # view > > <img src="{{=URL(r=request,f='image_mat')}}"/> > > => this can be extended for interactive plotting using > * form as input > * numpy /scipy as support for the math > > @Massimo > You may add this to the examples. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

