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

Bob Klimek klimek@grc.nasa.gov
Tue, 29 May 2001 13:40:07 -0400

This (16-bit) is a capability would be useful for me too, but one reason I 
believe why this is not implemented is that rest of PIL supports only 8-bit 
grayscale or 24-bit color images. Many of the filtering routines (at least 
last time I checked) were hard coded for 8-bit images. As such it would be 
incompatible with rest of PIL. My guess, anyway.


At 03:48 PM 5/25/2001 -0500, you wrote:
>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
>Image-SIG maillist  -  Image-SIG@python.org