Class ColorTransformOptions
How a color conversion maps colors: the rendering intent, black point compensation, and for HDR sources, tone mapping, the source peak and reference white.
public sealed record ColorTransformOptions : IEquatable<ColorTransformOptions>
- Inheritance
-
ColorTransformOptions
- Implements
- Inherited Members
Examples
// A transform is compiled once (and cached), then applied to spans of any pixel type, in place or into another type.
ColorTransform transform = ColorTransform.Create(ColorProfile.DisplayP3, ColorProfile.Srgb, new ColorTransformOptions { Intent = RenderingIntent.Perceptual });
Rgba8[] pixels = [new(255, 0, 0, 255), new(0, 128, 255, 128)];
transform.Apply<Rgba8>(pixels);
RgbaF32[] wide = new RgbaF32[pixels.Length];
transform.Apply<Rgba8, RgbaF32>(pixels, wide); // float types keep values outside 0..1
Properties
BlackPointCompensation
Gets a value indicating whether to map the source's black to the target's (Adobe's black point compensation), which keeps shadow detail when converting between devices with different blacks. Defaults to false. Perceptual and saturation conversions into a version 4 ICC profile always compensate, as ICC requires.
public bool BlackPointCompensation { get; init; }
Property Value
Default
Gets the defaults: perceptual, without black point compensation, as Little CMS and Pillow default to; BT.2390 for HDR.
public static ColorTransformOptions Default { get; }
Property Value
Intent
Gets the rendering intent. Defaults to Perceptual.
public RenderingIntent Intent { get; init; }
Property Value
ReferenceWhiteNits
Gets the luminance an HDR encoding's reference white has, in cd/m², which becomes 1.0 in linear light and SDR white. Defaults to 203, as ITU-R BT.2408 recommends.
public double ReferenceWhiteNits { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value set is not a positive finite number.
SourcePeakNits
Gets the brightest light in the source, in cd/m², or null to take it from the raster's Hdr (MaxCLL, then the mastering display's peak), else 1,000 cd/m².
public double? SourcePeakNits { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value set is not a positive finite number.
ToneMapping
Gets how a conversion from an HDR encoding (PQ or HLG) to an SDR one brings highlights into range, then clips what is still out of the target's gamut toward each pixel's luminance, which keeps hue. Defaults to Bt2390; Clip turns it off. HDR to HDR and SDR conversions never tone map.
public ToneMapping ToneMapping { get; init; }