I do not seem to have success in generating a dynamic image into Internet
Explorer through CGI. If I save the file and then load it, it works but
when I try to keep the generated image dynamic. I am using Python 2.6.5 and
the corresponding PIL library.
f = cStringIO.StringIO()
img.save(f, "PNG")
print "Content-type: image/png\n"
f.seek(0)
print f.read()
The above will just generate a screen filled with ascii characters and
symbols. I have also tried JPEG to no avail.
Below generates a blank image:
sys.stdout.write('Status: 200 OK\r\n')
sys.stdout.write('Content-type: image/png\r\n\n')
sys.stdout.write('%s' % f.getvalue())
sys.stdout.write('\r\n')
Can someone point out my error here? Writing to file in a cgi environment
is not a great thing to be doing. Img.sav('test.png') is valid.
_______________________________________________
Image-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/image-sig