[Image-SIG] Help with TIFF images

dvarrazzo at virgilio.it dvarrazzo at virgilio.it
Wed Apr 6 17:44:23 CEST 2005


Hi everybody,

i want to open a 16 bit grayscale TIFF file with photometric interpretation
0 (white is 0). Such files are a common densitometers product.

The corrispondenting format key is (0, 1, 1, (16,), ()) in PIL 1.1.5 (it
used to be (0, 1, (16,), ()) in previous releases. This key is missing from
TIFF OPEN_INFO dict, resulting in an unsupported format.

I addd the same value as for the key (1, 1, 1, (16,), ()), i.e. ("I;16",
"I;16"). The file is open, of course, in negative form. Anyway this is not
a big problem, because i don't have to display the image: i perform image
processing in numarray, passing the data array to it with a fromstring()/tostring()
pair.

What is the correct value to read such images?

When i come to save the image after editing, i pass it back to PIL via fromstring()
with mode="I;16". This way the file is stored "black is 0", so i hack the
interpretation bit "by hand" (some control tools only open this very combination).

Can i set mode so that the file is stored "white is 0"?

Thank you in advance

Daniele





More information about the Image-SIG mailing list