"Matt G" wrote:
> 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"
the "format" attribute is only set on image objects that are
read directly from a file; once you start processing the image,
the format is no longer defined.
if you need to keep track of the original format, just copy the
attribute to a separate variable:
format = pil.format
pil = pil.transport(...)
...
pil.save(outfile, format=format)
</F>