[Image-SIG] 16 bit TIFF's, SAMPLEFORMAT tag

Julian Humphries julian@essaustin.com
Fri, 25 May 2001 15:48:49 -0500

I regularly use 16 bpp TIFF files and was having problems opening simple
unsigned integer grayscale TIFF's with PIL 1.1.1.  I took a look at
TiffImagePlugin.py and noticed that the I:16 format was recognized only
if the SAMPLEFORMAT tag (339) was '2'.  Upon further research, this 
seemed odd, the default for the tag is 1 (unsigned integer) and many
programs leave off the tag when saving 16 bit TIFF's. The code later
in the module assigns a default of '1' as well, assuring the file won't
be recognized.  

My question is whether there is a reason for only recognizing type '2' 
which is a "two s complement signed integer data" according to Adobe. I
tried changing/and adding a recognized format of (1,1,(16,),()) as I;16
and things seemed to work but I didn't exercise PIL very much.

Any thoughts or suggestions?

Julian Humphries
University of Texas

P.S.  PIL 1.1.1, Python 1.5.2, on PC with NT4