"cyberco" <[EMAIL PROTECTED]> wrote:

> I'm using web.py to send an image to the client. This works
> (shortened):
> 
> print open(path, "rb").read()
> 
> but this doesn't:
> 
> img = Image.open(path)
> img.thumbnail((10,10))
> print img.getdata()
> 
> or
> 
> print img.load()
> 
> 
> How do I get the bytes of the Image object? 'getdata()' seemed the
> way, but unfortunately...
> 

getdata() returns the data in a PIL format. Saving the image, in a 
format your client understands, to a file like object like 
StringIO.StringIO is an easy path to take.

Sparklines shows this in action:

http://bitworking.org/projects/sparklines/


max

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to