CGI to make PNG image

effbot at pythonware.com effbot at pythonware.com
Thu Aug 17 13:33:38 EDT 2000


Andre van Straaten wrote:
> MSIE can't read png images at all

not true.  MSIE has provided basic PNG support
since the first 4.0 betas.

Take Sato wrote:
> I made a simple CGI script to return images on WinNT
> with Apache1.3.12.
>
> > import Image
> > try:
> >     import msvcrt,os  #set standard output to binary mode
> >     msvcrt.setmode(sys.stdout.fileno(),os.O_BINARY)
> > except: pass

not sure what's causing this, but you could try running
the python interpreter with the -u option (binary mode,
no buffering).

:::

if that doesn't help, try saving to a StringIO object:

    outfile = StringIO.String()
    image.save(outfile, "png")
    print outfile.getvalue()

</F>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list