Table of Contents

Method TryGetCicpColorSpace

Namespace
PaintDotNet.Imaging
Assembly
PaintDotNet.Windows.Core.dll

TryGetCicpColorSpace(IColorContext, out CicpColorSpace)

Tries to determine the CICP color information that best describes the given ICC color profile. This is the inverse of CreateColorContext(IImagingFactory, CicpColorSpace): it derives the values for e.g. a PNG cICP chunk (or AVIF nclx) from a profile.

public static bool TryGetCicpColorSpace(this IColorContext colorContext, out CicpColorSpace cicpColorSpace)

Parameters

colorContext IColorContext
cicpColorSpace CicpColorSpace

Returns

bool

true and the CICP color information if it could be determined; otherwise false.

Remarks

Detection proceeds from most to least authoritative: an embedded ICC cicp tag is honored verbatim; otherwise an RGB matrix/TRC profile is reconstructed by matching its colorants to a known set of primaries and its transfer curve to a known transfer function. Profiles whose primaries or transfer cannot be recognized (e.g. Adobe RGB, ProPhoto RGB, CMYK, grayscale, or LUT-only profiles) yield false.

Except where an embedded cicp tag specifies otherwise, the result always has MatrixCoefficients of Identity and VideoFullRangeFlag of Full, since an ICC profile describes full-range RGB.