A question about PIL attributes

Matt G python at bizniche.com
Wed Apr 9 13:12:39 EDT 2003


I'm resending this, and including the Python-list..as suggested by the PIL support page.

Hi.  I'm using the Python Image Library  to do some image manipulations.  I like that the PIL 
objects have attributes like format, size, info (dictionary) 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030409/ce88c2cb/attachment.html>


More information about the Python-list mailing list