[Image-SIG] problem with PIL's Image.save() on TIFFs

Fredrik Lundh fredrik at pythonware.com
Thu Feb 28 19:07:40 CET 2008


Guy K. Kloss wrote:

> I've just had some problems with PIL's implementation of the Image.save() 
> method when writing TIFF files. Apparently some internal tags on resolution 
> are totally out of the normal. Using the TIFFs from libtiff later on produces 
> some warning on a tag with bad information.
> 
> This is what libtiff's warning handler produces:
> 
> _TIFFVSetField: diag.tif: Bad value 47088 for "ResolutionUnit".
> diag.tif: Warning, "YResolution": Information lost writing value 
> (-2.94176e-05) as (unsigned) RATIONAL.

PIL doesn't create resolution tags by itself, so unless you add it 
yourself, or roundtrip an existing TIFF file, the file shouldn't contain 
any resolution tags at all.

if the former, it would help if you could post the code you're using to 
set the tags.

if the latter, please post the contents of im.tags.items(), just before 
you save the file.  e.g.

     print im.tags.items()
     im.save("out.tif")

 > To me this very much sounds like an issue with uninitialised 
variables > in some structures

There's really no such thing as an uninitalized variable in Python...

</F>



More information about the Image-SIG mailing list