AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2008.05.16 21:24 "[Tiff] 32 bit samples", by Garry Petrie
2008.05.17 16:34 "[Tiff] 32 bit samples", by Garry Petrie
2008.05.17 19:22 "Re: [Tiff] 32 bit samples", by Bob Friesenhahn
2008.05.19 04:51 "[Tiff] RE: Tiff Digest, Vol 48, Issue 6", by Garry Petrie
2008.05.19 10:36 "Re: [Tiff] Re: 32 bit samples", by Gerben Vos
2008.05.18 08:59 "Re: [Tiff] 32 bit samples", by Andrey Kiselev

2008.05.19 10:36 "Re: [Tiff] Re: 32 bit samples", by Gerben Vos

Interesting comments concerning RGB inputs. I assumed there were tags in the file declaring it as a BW image at least.

There are. (I've downloaded some geotiff data and looked at the TIFF headers.) But the sample format is also declared as "IEEE floating point", and this is not widely implemented. In each case, the libtiff simple RGBA interface doesn't implement it. And since floating point data is not part of "baseline TIFF", you cannot expect image viewers to support it.

That you got an error from TIFFRGBAImageOK is logical: it checks whether the rest of the TIFFRGBA* code will understand this TIFF, which it won't.

You should forget about the RGBA interface. However, you can read the data quite easily using TIFFReadScanline() or some other libtiff function. These functions are really not so hard to work with. They'll simply return a buffer containing a 32-bit float for every pixel.

Unfortunately, I too don't know much about TIFFs with geographical data (yet). There are some people on this list that do. But I think this should help you a bit further.

For other interested people, here's the tiffdump output of the sample I downloaded:

NED_09317122.tif:
Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 31493876 (0x1e08ef4) next 0 (0)
ImageWidth (256) SHORT (3) 1<2793>
ImageLength (257) SHORT (3) 1<2819>
BitsPerSample (258) SHORT (3) 1<32>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 2819<8 11180 22352 33524 44696 55868 67040 78212 89384 100556 111728 122900 134072 145244 156416 167588 178760 189932 201104 212276 223448 234620 245792 256964 ...>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) SHORT (3) 1<1>
StripByteCounts (279) LONG (4) 2819<11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 11172 ...>
XResolution (282) RATIONAL (5) 1<1>
YResolution (283) RATIONAL (5) 1<1>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<1>
Software (305) ASCII (2) 126<IMAGINE TIFF Support\nCop ...>
SampleFormat (339) SHORT (3) 1<3>

33550 (0x830e) DOUBLE (12) 3<0.000277778 0.000277778 0> 33922 (0x8482) DOUBLE (12) 6<0 0 0 -102.612 43.8022 0>

34735 (0x87af) SHORT (3) 24<1 1 0 5 1024 0 1 2 1025 0 1 1 1026 34737 230 0 2048 0 1 4269 2054 0 1 9102>
34737 (0x87b1) ASCII (2) 231<IMAGINE GeoTIFF Support\n ...>

Gerben.