Image to browser

danielatdaveschool at danielatdaveschool at
Wed Jan 16 06:16:16 CET 2008

Hi, noob here

Im using mod_python and apache2 using psp for output of page, i open a
file and resize it with the following code

import Image, util

fields = util.FieldStorage(req)
filename = fields.getlist('src')[0]

path = '/var/www/content/' + filename
size = 128, 128

im =
print im.resize(size, Image.ANTIALIAS)

so for one, I dont think print does much with psp as far as i can
tell, i cant even do a print 'hello world', it has to be a
req.write('hello world'), but i cant req.write the im.resize. The
manual for im.resize states that its return can go ahead and be
streamed via http but I get a blank page when im expecting to see
image characters dumped to my screen. Python doesn't throw up any
errors. Im not sure where else to look or what to do.

Thanks for any help,

More information about the Python-list mailing list