Distinguish between transparency and extra alpha c

2019-09-04 14:54发布

问题:

I am sorry in advance if I am not explaining my question really well. I am not 100% aware of the stuff I am asking.

Lets say that I have some CMYK tiff files. Is there a way that I can distinguish the difference between transparency and extra alpha channel ?

I used exiftools in the terminal with the command : exiftool -G -S filename.tif and I got a tag (ExtraSamples) that provides information about the alpha channel. Is there a way that I can distinguish the aforementioned difference ?

Thanks.

回答1:

See the ExtraSamples TIFF tag description. According to the specification, the tag can have one of three values (per sample above the "natural" number of samples for the color model, i.e. 1 for gray, 3 for RGB or 4 for CMYK):

0 = Unspecified data

1 = Associated alpha data (with pre-multiplied color)

2 = Unassociated alpha data

Now, what you mean by "the difference between transparency and extra alpha channel" isn't really clear to me, as I often use the terms "transparency" and "alpha channel" interchangeably. Perhaps you just mean the above (1 "associated" vs 2 "unassociated" alpha).

Any other extra samples, will use 0 ("unspecified"). Note that these extra samples are not used for transparency or alpha information. However, their meaning is application specific, and would require further context to properly interpret. So if your file contains unspecified ExtraSamples, this is most likely not alpha channels or transparency at all.

The link in your comment makes it somewhat more clear what you refer to by "the difference between transparency and extra alpha channel". However, the link talks about the difference between an alpha channel and a (bit) mask, which are just two types of transparency.

ExtraSamples in a TIFF is typically not used for bit masks, instead a separate IFD with SubFileType "mask" (4) is used.