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

Guy K. Kloss G.Kloss at massey.ac.nz
Fri Feb 29 04:02:39 CET 2008

On Fri, 29 Feb 2008 7:07:40 am Fredrik Lundh wrote:
> 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.

I'm not setting any tags. I'm capturing an image through OpenCV (web cam), 
using opencv.adaptors.Ipl2PIL() to get a PIL image. That one is just written 
out using myImage.save('foo.tif')

> 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")

In [6]: myImage.tag.items()
[(256, (640,)),
 (257, (480,)),
 (258, (8, 8, 8)),
 (259, (1,)),
 (262, (2,)),
 (273, (128,)),
 (278, (480,)),
 (277, (3,)),
 (279, (921600,))]

Hopefully that's enlightening to you. It surely isn't to me ... :)

Unfortunately I couldn't find any documentation on the "tag" attribute at 

> > 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...

No, but I assume that PIL is implemented in C/C++ behind the scenes, and it's 
accessed through a wrapper. And in C it is very well possible and a common 
mistake. Just look at what students here are cooking up and you know what I 
mean ... :-/



Guy K. Kloss
Institute of Information and Mathematical Sciences
Te Kura Putaiao o Mohiohio me Pangarau
Room 2.63, Quad Block A Building
Massey University, Auckland, Albany
Private Bag 102 904, North Shore Mail Centre
voice: +64 9 414-0800 ext. 9585   fax: +64 9 441-8181
eMail: G.Kloss at massey.ac.nz  http://iims.massey.ac.nz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.python.org/pipermail/image-sig/attachments/20080229/45a5e2af/attachment.pgp 

More information about the Image-SIG mailing list