Page 1 of 1

Tiff image without TIFFTAG_PHOTOMETRIC won't load

Posted: 2019-08-21T19:24:53-07:00
by wmandrews
A tiff file without the TIFFTAG_PHOTOMETRIC tag will fail to load with ImproperImageHeader Exception.

line 1375 in coders\tiff.c initializes:
photometric=PHOTOMETRIC_RGB;
but the call in line 1378:
(TIFFGetFieldDefaulted(tiff,TIFFTAG_PHOTOMETRIC,&photometric) != 1)
does not use that,

It has a case statement for the defaults which does not have a case for "TIFFTAG_PHOTOMETRIC"
Adding the following case at line 299 in tiff\libtiff\tif_aux.c fixes the issue.
case TIFFTAG_PHOTOMETRIC:
*va_arg(ap, uint16 *) = PHOTOMETRIC_RGB;
return (1);

Re: Tiff image without TIFFTAG_PHOTOMETRIC won't load

Posted: 2019-08-23T04:17:30-07:00
by 246246
TIFFTAG_PHOTOMETRIC is required field. There is no default. See https://www.awaresystems.be/imaging/tif ... ation.html