2010.11.16 17:48 "[Tiff] unknown field with tag 317 (0x13d) encountered.", by E. Rosten

2010.11.16 17:48 "[Tiff] unknown field with tag 317 (0x13d) encountered.", by E. Rosten

I'm trying to read a TIFF file, which seems to have the predictor set. I get the error message:

TIFFReadDirectory: Warning, std::istream: unknown field with tag 317 (0x13d) encountered.

and the TIFF appears to be quantized to a very small number of levels.

This is from my own software and I get very similar results from other software installed on the system. I have tried the latest version (3.9.4), with the following results from the configure script:

Libtiff is now configured for x86_64-unknown-linux-gnu

   Installation directory:             /usr/local
   Documentation directory:            ${prefix}/share/doc/tiff-3.9.4
   C compiler:                         gcc -std=gnu99 -g -O2 -Wall -W
   C++ compiler:                       g++ -g -O2
   Enable runtime linker paths:        no
   Support Microsoft Document Imaging: yes

  Support for internal codecs:
   CCITT Group 3 & 4 algorithms:       yes
   Macintosh PackBits algorithm:       yes
   LZW algorithm:                      yes
   ThunderScan 4-bit RLE algorithm:    yes
   NeXT 2-bit RLE algorithm:           yes
   LogLuv high dynamic range encoding: yes

  Support for external codecs:
   ZLIB support:                       yes
   Pixar log-format algorithm:         yes
   JPEG support:                       yes
   Old JPEG support:                   yes
   ISO JBIG support:                   no

   C++ support:                        yes

   OpenGL support:                     yes

tiffdump gives:

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 470607 (0x72e4f) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) LONG (4) 1<180>
ImageLength (257) LONG (4) 1<180>
BitsPerSample (258) SHORT (3) 1<16>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<1>
ImageDescription (270) ASCII (2) 247<Acquired from Photometri ...>
StripOffsets (273) LONG (4) 9<8 7928 15848 23768 31688 39608 47528 55448 63368>
RowsPerStrip (278) LONG (4) 1<22>
StripByteCounts (279) LONG (4) 9<7920 7920 7920 7920 7920 7920 7920 7920 1440>
XResolution (282) RATIONAL (5) 1<72>
YResolution (283) RATIONAL (5) 1<72>
ResolutionUnit (296) SHORT (3) 1<2>

Software (305) ASCII (2) 14<MetaMorph 6.1\0>

DateTime (306) ASCII (2) 20<2010:11:16 13:12:36\0>
Predictor (317) SHORT (3) 1<1>
33628 (0x835c) LONG (4) 10037<0 1 1 1395 2 2298 3 1 4 65177 5 65185 6 65193 7 65202 8 0 9 255 10 0 11 128 ...>

I.e. it correctly identifies the field.

I have managed to convert the file to a readable format, using MATLAB, but

I'd like to be able to use libtiff. The original file and converted one is available here:

Base URL:
http://mi.eng.cam.ac.uk/~er258/

Image files:
t20f50005000.tif
good-t20f50005000.tif

If anyone is interested in what I am doing wrong, my code is available.

The TIFF reading part id on lines 233--254:

http://cvs.savannah.gnu.org/viewvc/*checkout*/libcvd/libcvd/pnm_src/tiff.cxx?revision=1.16&content-type=text%2Fplain

Also, does anyone recognise the 33628 field? I can't find anything useful

online.

Regards,

-Ed