THOGROM.terra.es wrote:
Hello list!
I'm using python to store some images as strings.
        image = PIL.Image.open(sname)
        self.__simagestr = image.tostring()
        os.remove(sname)

tostring() just returns pixels data. If you want opening the string through StringIO later you just can do:


self.__simagestr = open(sname).read()

Later, I have to store this string on a file:
def savedraw(self, suri):
       #suri is a path like "/home/image.jpeg"
        data = StringIO.StringIO(self.__simagestr)
        im = PIL.Image.open(data)
        im.save(data,'JPEG')

im.save(suri, 'JPEG') ?

But the system shows the next error when execute PIL.Image.open(data)
    raise IOError("cannot identify image file")

-- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig

Reply via email to