[Image-SIG] Re: how can I use img.tostring()
DrTebi
DrTebi" <drtebi@yahoo.com
Thu, 17 Apr 2003 21:18:04 +0200
Great, thanks so much, it works now. This is what I was trying to
accomplish:
import Image
from popen2 import popen2
import StringIO
original = 'princesa.jpg'
img = Image.open(original)
img.thumbnail((200,200))
file = StringIO.StringIO()
img.save(file, "JPEG")
thumb = file.getvalue()
# this now works ;)
pout, pin = popen2('attr -q -s thumbnail ' + original)
pin.write(thumb)
pin.close()
It's still a little baby, but I think the idea of using extended attributes
and putting the thumbnail of an image into an attribute is a very nifty
thing...
By the way, I am surprised how fast the Image library is. Doing the same
with PHP, which usually uses the GD library, was significally slower. Is
there a specific reason for this?
DrTebi