CGI to make PNG image
Andre van Straaten
andre at UltraShell.Net
Thu Aug 17 12:04:11 EDT 2000
MSIE can't read png images at all, NN can from version 4.7 (or 4.6 ?).
Try
www.vanstraatensoft.com/fetchmail.png
and
www.vanstraatensoft.com/fetchmail.gif
I changed that image some month ago.
png is much propagated, but not much supported.
-- avs
Take Sato <tkssato at yahoo.co.jp> 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.
> (IE5.0 and NS4.5 cannot understand it as correct image)
> I don't know what's wrong with it.
> Can anyone help me ?
> -----------------------------
> import Image
> try:
> import msvcrt,os #set standard output to binary mode
> msvcrt.setmode(sys.stdout.fileno(),os.O_BINARY)
> except: pass
> im=Image.open("foo1.jpg")
> ... # some operation
> print "Content-type: image/png"
> print
> im.save(sys.stdout,"png")
> #NOTE! above script works fine if it's like following,
> # (once saved as file and reopened.)
> print "Content-type: image/png"
> print
> im.save("foo2.png","png")
> print open("foo2.png","rb").read()
--
Andre van Straaten
http://www.vanstraatensoft.com
______________________________________________
flames please to /dev/null at vanstraatensoft.com
More information about the Python-list
mailing list