Table of Contents

Class GainMapOptions

Namespace
Egami.Colors
Assembly
Egami.dll

How Create(Raster, Raster?, GainMapOptions?) and GainMap make a gain map (HDR Design question 10). The defaults are libultrahdr's: a full-size map with a gain for each of red, green and blue, gamma 1, encoded at quality 95.

public sealed record GainMapOptions : IEquatable<GainMapOptions>
Inheritance
GainMapOptions
Implements
Inherited Members

Examples

// An HDR raster as Ultra HDR: the SDR base, tone mapped with BT.2390, and a gain map that brings the HDR raster back.
using Raster<RgbaF32> hdr = Raster.Load<RgbaF32>("render.exr");
hdr.Save("render.jpg", new JpegWriterOptions { Quality = 90, GainMap = new GainMapOptions() });

// Or choose the SDR rendition: the map goes in its metadata, and saving as JPEG writes both.
using Raster<Rgb8> sdr = hdr.Derive(ops => ops.ToneMap(ToneMapping.Reinhard)).As<Rgb8>();
sdr.Metadata.GainMap = GainMap.Create(hdr, sdr, new GainMapOptions { Scale = 4 });
sdr.Save("graded.jpg", new JpegWriterOptions { Quality = 90 });

Properties

Default

Gets the default options.

public static GainMapOptions Default { get; }

Property Value

GainMapOptions

Gamma

Gets the gamma the gains are stored with; above 1 spends more of the 256 steps on small gains. Defaults to 1.

public double Gamma { get; init; }

Property Value

double

Exceptions

ArgumentOutOfRangeException

The value is not positive and finite.

Headroom

Gets the display headroom at which the full HDR rendition shows (HdrCapacityMax, linear), or null (the default) for the largest gain the map stores; displays with less headroom show part of it.

public double? Headroom { get; init; }

Property Value

double?

MaxContentBoost

Gets the largest gain to store, linear, or null (the default) for the largest the image needs.

public double? MaxContentBoost { get; init; }

Property Value

double?

MinContentBoost

Gets the smallest gain to store, linear (0.5 lets the HDR rendition be half as bright as SDR in places), or null (the default) for the smallest the image needs.

public double? MinContentBoost { get; init; }

Property Value

double?

MultiChannel

Gets a value indicating whether the map holds a gain for each of red, green and blue, so HDR colors brighter than SDR can show (a color map), rather than one gain from luminance (a gray map, a third of the size). Defaults to true.

public bool MultiChannel { get; init; }

Property Value

bool

Offset

Gets the offset added to SDR and HDR values before their ratio, which keeps gains near black small. Defaults to 1/64.

public double Offset { get; init; }

Property Value

double

Quality

Gets the JPEG quality of the gain map image, 1 to 100. Defaults to 95.

public int Quality { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 1 to 100.

Scale

Gets how many times smaller than the image the map is on each side, 1 to 128: 4 makes a map a sixteenth of the pixels, as phone cameras write. Defaults to 1.

public int Scale { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 1 to 128.