|Baseline TIFF Tag ExtraSamples|
TIFF Tag Reference
TIFF Tag ExtraSamples
Description of extra components.
Specifies that each pixel has N extra components whose interpretation is defined by one of the values listed below. When this field is used, the SamplesPerPixel field has a value greater than the PhotometricInterpretation field suggests.
For example, full-color RGB data normally has SamplesPerPixel=3. If SamplesPerPixel is greater than 3, then the ExtraSamples field describes the meaning of the extra samples. If SamplesPerPixel is, say, 5 then ExtraSamples will contain 2 values, one for each extra sample. ExtraSamples is typically used to include non-color information, such as opacity, in an image. The possible values for each item in the field's value are:
0 = Unspecified data
LibTiff defines these values:
EXTRASAMPLE_UNSPECIFIED = 0;
The difference between associated alpha and unassociated alpha is not just a matter of taste or a matter of maths.
Associated alpha is generally interpreted as true transparancy information. Indeed, the original color values are lost in the case of complete transparency, and rounded in the case of partial transparency. Also, associated alpha is only logically possible as the single extra channel.
Unassociated alpha channels, on the other hand, can be used to encode a number of independent masks, for example. The original color data is preserved without rounding. Any number of unassociated alpha channels can accompany an image.
If an extra sample is used to encode information that has little or nothing to do with alpha, ExtraSample=0 (EXTRASAMPLE_UNSPECIFIED) is recommended.
Note also that extra components that are present must be stored as the last components in each pixel. For example, if SamplesPerPixel is 4 and there is 1 extra component, then it is located in the last component location (SamplesPerPixel-1) in each pixel.
This field must be present if there are extra samples.