[gdal-dev] Unusual RGB Tiff files with misleading PhotometricInterpretation: valid or not?

Even Rouault even.rouault at spatialys.com
Thu Nov 15 12:20:36 PST 2018


Mikael,

> 1.  If an RGB Tiff file doesn't have PhotometricInterpretation = RGB, can it
> really be claimed that the file adheres to the Tiff standard, or is it
> corrupt?

If it has 2 values for ExtraSamples, then I believe is technically legal (the 
TIFF spec is not really clear but libtiff interprets PhotometricInterpretation 
= MinIsBlack as meaning one nominal channel, all the other ones being extra 
samples), but of course, readers are not expected to interpret such 3-channel 
files as being RGB.

> 2.  If the min and max intensities are not the same as the min and max
> representable numbers for the integer type, then how are they specified in
> Tiff?

There are MinSampleValue and MaxSampleValue tags in the TIFF spec, but those 
are not really used by GDAL and are just reported as metadata.

$ cp byte.tif test.tif
$ tiffset -s MinSampleValue 1 0 test.tif
$ tiffset -s MaxSampleValue 1 255 test.tif
$ gdalinfo test.tif
[...]
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_MAXSAMPLEVALUE=255
  TIFFTAG_MINSAMPLEVALUE=0

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list