Re: [Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Chris Hare
Thanks! That did it. The second part of my function is to drop the image in the StringIO buffer into a Tkinter canvas widget. If I do this: self.imageBuffer.seek(0) image = Image.open(self.imageBuffer) self.picture1.create_image(0, 0, image = image ) self.picture1 = Canvas(self.pictureFrame

Re: [Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Chris Barker
On Fri, Apr 27, 2012 at 6:21 AM, Charles Cazabon wrote: >> I am stuck however, in figuring out how to take the string data and >> converting it back to an image that I can put into the canvas widget. > > See the PIL handbook, where it says "If you have an entire image file in a > string, wrap it

Re: [Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Gareth Rees
Chris Hare wrote: > okay - I have an error but I don't understand what I got wrong: > > self.imageBuffer = StringIO.StringIO() > image = Image.open(filename) > image = image.resize((150,150),Image.ANTIALIAS) > image.save(self.imageBuffer, format= 'PNG') > image = Image.open(self.imageBuffer) > IOE

Re: [Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Chris Hare
okay - I have an error but I don't understand what I got wrong: self.imageBuffer = StringIO.StringIO() image = Image.open(filename) image = image.resize((150,150),Image.ANTIALIAS) image.save(self.imageBuffer, format= 'PNG') image = Image.open(self.imageBuffer) IOError: cannot identify image fi

Re: [Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Charles Cazabon
Chris Hare wrote: > > I am stuck however, in figuring out how to take the string data and > converting it back to an image that I can put into the canvas widget. See the PIL handbook, where it says "If you have an entire image file in a string, wrap it in a StringIO object, and use open to load

[Image-SIG] PIL and converting an image to and from a string value

2012-04-27 Thread Chris Hare
Here is what I am trying to: the application user chooses an image file. I want to store the image data in a field in a sqlite database. My understanding from the reading I have done is that I have to convert the image data into a string , which I can then store in the database. Additionall