CGI to make PNG image

Take Sato tkssato at yahoo.co.jp
Fri Aug 18 02:44:27 EDT 2000


Thanks everyone.
Thanks Effbot. I forgot to use StringIO class and you reminded me.

Well, I tried to figure out what's the matter
and came to a conclusion as descrbed in following.


1. Windows version of PIL write the string "65536"to standard output
    when saving PNG images. (This is not the case with Linux version.)
   That was a problem!
   The situation is avoided by redirecting sys.stdout to some dummy buf
   (say, StringIO.StringIO())  only when saving images.

2. Curiously,
   MSIE5.0 on WinNT sometimes failed in dealing with PNG images
   returned by CGI script in case the script name is designated as URL.
   While the script is called in img tags in HTML files, it works OK.

   As to other browser(MSIE5.0,NS4.6 on Win98, NS4.6 on WinNT, NS4.07 on
Linux),
   things like that don't happen. They allways seem to work all right.

   Anyway I'm not too sure about that, which browser deals with PNG
correctly.


Take Sato wrote:

> I made a simple CGI script to return images on WinNT with Apache1.3.12.
>
> It works all right to return JPEG,GIF,BMP images,
> but not with PNG.




More information about the Python-list mailing list