Re: PIL: reading bytes from Image

2007-03-12 Thread Larry Bates
cyberco wrote: > Thanks, > > I've tried the StringIO option as follows: > > = > img = Image.open('/some/path/img.jpg') > img.thumbnail((640,480)) > file = StringIO, StringIO() > img.save(file, 'JPEG') > > = > > But it gives me: >

Re: PIL: reading bytes from Image

2007-03-11 Thread Max Erickson
"cyberco" <[EMAIL PROTECTED]> wrote: > Thanks, > > I've tried the StringIO option as follows: > > = > img = Image.open('/some/path/img.jpg') > img.thumbnail((640,480)) > file = StringIO, StringIO() Is the above line exactly what you tried? If it is, the comma and

Re: PIL: reading bytes from Image

2007-03-11 Thread cyberco
Thanks, I've tried the StringIO option as follows: = img = Image.open('/some/path/img.jpg') img.thumbnail((640,480)) file = StringIO, StringIO() img.save(file, 'JPEG') = But it gives me: = exceptio

Re: PIL: reading bytes from Image

2007-03-10 Thread Max Erickson
"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

PIL: reading bytes from Image

2007-03-10 Thread cyberco
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 unfortuna