How to generate graphics dynamically on the web using Python CGI script?

Xavier Morel xavier.morel at masklinn.net
Fri Jan 20 10:37:35 EST 2006


Steve Holden wrote:
> Luiz Geron wrote:
>> I don't have experience on this, but I think that you can make the
>> script return the image "contents" directly to the img tag, without
>> passing it to a img file, so you can use something like this:
>>
>> <img src="script_that_return_image_contents">
>>
>> wich saves some processing and I/O.
>>
> No it doesn't, because the script that generates the graphic is then a 
> different script from the one that generates the referring HTML. I agree 
> that scripted generation of the graphical content is a viable option 
> that I overlooked, though it seems from the OP's inquiry that he already 
> uses CGI to generate the HTML.
> 
> regards
>   Steve

Generate inline base64 encoded images in your HTML page and you're done.
(yes, this is ugly, but it generates both HTML and graphics in the same 
script)



More information about the Python-list mailing list