Adding private tags to a tiff file.

O Evans o.evans at gmail.com
Fri Aug 11 08:18:15 EDT 2006


Hi there,

I'm manipualating tiff images captured by a program that insists on
using annoying private tags. I want to be able to import an image that
I have created into the program but I cannot get PIL to save the
private tag. Here is a simplified version of the code I am using:

import Image
original = Image.open(r"test.tif")
original.tag[34118] = "life"
print "Before saving" , original.tag[34118]
original.save("test2.tif")
altered = Image.open(r"test2.tif")
if altered.tag.tagdata.has_key(34118):
	print "It worked!"

Is there a way of getting this to work? I have tried looking at
TiffTags and TiffImageFile, but I cannot understand why the tags are
not preserved. Or should I be looking at a different library?

Many thanks.




More information about the Python-list mailing list