[mod_python] Dynamic <IMG> with PIL

Robert Norman tfcrobert at gmail.com
Fri May 18 19:48:23 EDT 2007

I'm trying to create graphs on the fly with mod-python.  Using PIL I can get
a "jpeg" image as a string. Is there some way to wrap this information in an
IMG tag?  I gather that  src parameter in IMG is required so anythink like:

req.write("<IMG %s>"  % myString)

is not going to work.

One suggestion was to:

 <img src="get-graph.py?graphId=xyz" />


"get-graph.py is a python script. it sets the header to "image/jpeg" or
whatever format you want to use than you can use some python libraries to
create the image. Instead of saving the image to a file you just write it to

I don't understand the suggestion especially in the context of mod-python
since we want to use req to write the page.

What is a reasonable method to generate dynamic image graphics?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070518/021443b6/attachment.html

More information about the Mod_python mailing list