Gary Walker: >Here's some actual code of mine that doesn't work: > >************************************ >#!/usr/bin/python > >import StringIO, cgi, os, sys, string, Image > >im = Image.open('backgroundimage.gif') add--> , "rb" <-- here ^^ to make it im = Image.open('backgroundimage.gif', "rb") else it won't work on MS Windows or Macs. ># here I'll be drawing all over my image... > ># Now I want to send it to a browser... >sfp = StringIO.StringIO() >im.save(sfp,'gif') > >print 'Content-Type: image/gif\r\n\r\n' Replace this with sys.stdout.write("Content-Type: image/gif\r\n\r\n") because print adds its own "\n" after it prints the text. >sys.stdout.write(sfp.getvalue()) Andrew dalke at acm.org
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4