Opening TIFF with JPEG compression/YCbCr format displays incorrect warning
GIMP version: GIMP 2.10.14
Note: bug reporters are expected to have verified the bug still exists either in the last stable version of GIMP or on updated development code (master branch).
Operating System: macOS
(Verified on macOS, probably not OS specific)
Package: Installer from gimp.org.
Description of the bug
Opening a TIFF with JPEG compression in standard YCbCr format (3 channels, no alpha), will produce an incorrect warning:
Non-conformant TIFF: extra channels without 'ExtraSamples' field.
This is incorrect, as there are no extra channels in the file.
Reproduction
Always
Reproduction steps:
- Download
- Open the file in GIMP (File -> Open...)
- Select the file, click "Open" and see warning in the dialog (as in the screen shot above).
Expected result:
No warning should occur.
Actual result:
Warning as seen in the screenshot above.
Additional information
The bug seems to be in file-tiff-load.c:262 and the following lines. It wrongly assumes (from the comment):
All other color space [than RGB] expect 1 channel (grayscale, palette, mask).
That is, it ignores the presence of PhotometricInterpretation
s CMYK/5, YCbCr/6 and CIELab/8, that alle have multiple channels (4, 3 and 3 channels respectively). See TIFF 6.0 spec, for example "Appendix A: TIFF Tags Sorted by Number" on p. 117.
(It could be argued that the current behaviour is correct for baseline TIFF, but JPEG in TIFF is not baseline, and YCbCr is the most natural photometric for such files.)
The problem is only the warning tough, the file is opened as expected.