FIELD_IGNORE tags have misleading error message
In LibTiff there are TIFF tags that should not be read or written (abandoned, unwanted tags). To prevent them from being read as unknown, anonymous tags, they must be defined in tif_dirinfo.c as FIELD_IGNORE
.
For those tags, TIFFSetField()
returns 0 (error) and a missleading error message is stated, no matter which codec is active:
“Invalid tag "StripByteCounts" (not supported by codec)."
If such tags, or more precisely all custom tags with set_field_type = TIFF_SETGET_UNDEFINED
, are present in the TIFF file, no error message at all appears when reading in.
There are seven tags, which are defined with FIELD _IGNORE:
-
TIFFTAG_CELLWIDTH, TIFFTAG_CELLLENGTH those are related with the named tag TIFFTAG_THRESHHOLDING.
I do not see, why these two tags are FIELD_IGNORE but TIFFTAG_THRESHHOLDING not. Shouldn’t these two tags not be correctly defined as FIELD_CUSTOM? -
TIFFTAG_FREEOFFSETS, TIFFTAG_FREEBYTECOUNTS, TIFFTAG_GRAYRESPONSEUNIT, TIFFTAG_GRAYRESPONSECURVE and TIFFTAG_COLORRESPONSEUNIT which can stay as they are.
However, at least the error messages for FIELD_IGNORE tags should be corrected.
Furthermore, the tag TIFFTAG_OSUBFILETYPE is also an deprecated tag and TIFFSetField() leads to the same missleading error message. Therefore, this tag schould be set to FIELD_IGNORE to get also the amended error message.
Version: libtiff version 4.4.0
Steps to reproduce
Write one of the above mentioned FIELD_IGNORE tags using TIFFSetField().
Platform: Windows 10 x64, Visual Studio 2020 with CMake