[Image-SIG] PIL losing attributes...

Matt Graham python@bizniche.com
Mon, 07 Apr 2003 02:06:05 -0600


Hi.  I'm using PIL to do some image manipulations.  I like that the PIL 
objects have attributes like format, size etc.  My problem is...when I 
apply some filter, say ImageChops.invert, or Image.transpose, it looses 
the addributes.  For example

> if DEBUG: print "Before transpose, format is: " + str(pil.format)
> pil = pil.transpose(Image.FLIP_LEFT_RIGHT)
> if DEBUG: print "After transpose, format is: " + str(pil.format)

the first output prints "JPEG" or "GIF" or whatever.

after the transpose, the output is "None"

I tried this with and without the str() wrapper.  So...I'm guessing that 
the copy that returned from the transpose (or other filters) is part of 
the problem maybe?  Do I need to use some kind of copy constructor or 
something?  The same thing happens with the size attribute, or the info 
dictionary that I add.  

Any hints at all on this would be very appreciated.  It's really 
throwing a wrench into my app.

Thanks,
Matt