[Image-SIG] Reading unsigned integer tiffs

Mirko Scholz mirko.scholz at stud.uni-goettingen.de
Fri Jan 15 17:09:40 CET 2010


Hello,

I came across 32bit unsigned integer TIFF files (from a high dynamic range
pixel detector).  PIL currently does not support them, but applying the 
following patch on pil-117 did the job for me.  Maybe you can include it.

diff -r f356a1f64271 PIL/TiffImagePlugin.py
--- a/PIL/TiffImagePlugin.py	Sun Nov 15 19:03:47 2009 +0100
+++ b/PIL/TiffImagePlugin.py	Fri Jan 15 17:02:41 2010 +0100
@@ -141,6 +141,7 @@
     (II, 1, 1, 2, (8,), ()): ("L", "L;R"),
     (II, 1, 1, 1, (16,), ()): ("I;16", "I;16"),
     (II, 1, 2, 1, (16,), ()): ("I;16S", "I;16S"),
+    (II, 1, 1, 1, (32,), ()): ("I", "I;32N"),
     (II, 1, 2, 1, (32,), ()): ("I", "I;32S"),
     (II, 1, 3, 1, (32,), ()): ("F", "F;32F"),
     (II, 2, 1, 1, (8,8,8), ()): ("RGB", "RGB"),

The following is the output of tiffinfo on one of those files

TIFF Directory at offset 0x5a (90)
  Subfile Type: (0 = 0x0)
  Image Width: 487 Image Length: 195
  Resolution: 69.5714, 69.5714
  Bits/Sample: 32
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Rows/Strip: 195
  Planar Configuration: single image plane
  ImageDescription: 
  Model: 
  Software: TVX TIFF v 1.3     


Mirko



More information about the Image-SIG mailing list