Class ExrImage
Reads single OpenEXR channels that are not color, such as depth, object IDs or render passes.
public static class ExrImage
- Inheritance
-
ExrImage
- Inherited Members
Examples
// The first part's RGBA channels as linear light, 1.0 reference white; other layers by name.
using Raster<RgbaF32> beauty = Raster.Load<RgbaF32>("render.exr");
var details = (ExrDetails)beauty.Metadata.FormatDetails!;
IReadOnlyList<string> layers = details.Parts[details.Part].Layers; // "diffuse", "specular"
using Raster<RgbaF32> diffuse = Raster.Load<RgbaF32>("render.exr", options: new ExrReaderOptions { Layer = "diffuse" });
// Any one channel, such as depth or an object id, as 32-bit float.
using Raster<GrayF32> depth = ExrImage.ReadChannel("aov.exr", "Z");
Methods
ReadChannel(Stream, string, ExrReaderOptions?, EgamiContext?)
Reads one channel from a stream; see ReadChannel(string, string, ExrReaderOptions?, EgamiContext?).
public static Raster<GrayF32> ReadChannel(Stream stream, string channel, ExrReaderOptions? options = null, EgamiContext? context = null)
Parameters
streamStreamThe file's data, from its start.
channelstringThe channel's full name.
optionsExrReaderOptionsWhich part to read, and the general options; the layer and window are ignored.
contextEgamiContext
Returns
Examples
// The first part's RGBA channels as linear light, 1.0 reference white; other layers by name.
using Raster<RgbaF32> beauty = Raster.Load<RgbaF32>("render.exr");
var details = (ExrDetails)beauty.Metadata.FormatDetails!;
IReadOnlyList<string> layers = details.Parts[details.Part].Layers; // "diffuse", "specular"
using Raster<RgbaF32> diffuse = Raster.Load<RgbaF32>("render.exr", options: new ExrReaderOptions { Layer = "diffuse" });
// Any one channel, such as depth or an object id, as 32-bit float.
using Raster<GrayF32> depth = ExrImage.ReadChannel("aov.exr", "Z");
Exceptions
- ArgumentException
The part has no such channel.
ReadChannel(string, string, ExrReaderOptions?, EgamiContext?)
Reads one channel, such as "Z" or "diffuse.R", into a gray raster at the channel's stored resolution (smaller than the data window when the channel is subsampled). Half and uint samples convert to float; uint values above 2^24 lose their lowest bits.
public static Raster<GrayF32> ReadChannel(string path, string channel, ExrReaderOptions? options = null, EgamiContext? context = null)
Parameters
pathstringThe file.
channelstringThe channel's full name.
optionsExrReaderOptionsWhich part to read, and the general options; the layer and window are ignored.
contextEgamiContext
Returns
Examples
// The first part's RGBA channels as linear light, 1.0 reference white; other layers by name.
using Raster<RgbaF32> beauty = Raster.Load<RgbaF32>("render.exr");
var details = (ExrDetails)beauty.Metadata.FormatDetails!;
IReadOnlyList<string> layers = details.Parts[details.Part].Layers; // "diffuse", "specular"
using Raster<RgbaF32> diffuse = Raster.Load<RgbaF32>("render.exr", options: new ExrReaderOptions { Layer = "diffuse" });
// Any one channel, such as depth or an object id, as 32-bit float.
using Raster<GrayF32> depth = ExrImage.ReadChannel("aov.exr", "Z");
Exceptions
- ArgumentException
The part has no such channel.