2013.06.14 11:22 "[Tiff] : Tiff Decoder in case tiff color space is CIE LAB", by Sunanda Chowdhary

2013.06.14 12:03 "Re: [Tiff] : Tiff Decoder in case tiff color space is CIE LAB", by Joris Van Damme

Sunanda,

So according to description about the tags, if samples per pixel = 3 then color space is set to RGB.

Huh? Where does it say that? If SamplesPerPixel equals 3, that means only that you've three samples in a pixel, nothing else is implied.

Samples per pixel is useful in determining colorspace, sometimes. For example, combined with a LAB Photometric, SamplesPerPixel equal to 1 indicates that the image stores L, whilst SamplesPerPixel equal to 3 indicates that time image stores LAB.

Well, not quite, because I'm not taking ExtraSamples into account. The count of this tag plays a significant role, too. For instance, you could have a LAB Photometric, SamplesPerPixel could be 4, and ExtraSamples could have a count of 1. The image then stores LAB, and one additional channel. Or you could have a LAB Photometric, SamplesPerPixel could be 40, and ExtraSamples could have a count of 39. The image then stores L, and 39 additional channels.

But most of the time, the colorspace is exclusively determined by the Photometric tag, as with most colorspaces you don't have this ambiguity of the same Photometric being used for what is essentially more or less two different colorspaces. So, in most cases, SamplesPerPixel is more or less useful 'doublechecking consistency in the TIFF reader interpretation of the image'. For example, if Photometric is RGB, then the reader code could double-check if SamplesPerPixel subtracted by the count of ExtraSamples equals 3, and if it doesn't it'll take some extra robust response or more likely an error report.

In conclusion, Photometric is how you communicate the colorspace specification, not SamplesPerPixel.

Best regards,

Joris Van Damme

AWare Systems