Table of Contents

Enum SampleColor

Namespace
Egami.Formats
Assembly
Egami.dll

What the components of a SampleImage are.

[Experimental("EGAMIX001", UrlFormat = "https://github.com/inexin/Egami/blob/main/docs/articles/formats/index.md#stored-samples")]
public enum SampleColor

Fields

Gray = 1

One gray component, or gray then alpha.

Rgb = 2

Red, green and blue, then alpha when there is a fourth. A JPEG 2000 component transform (RCT or ICT) has been undone.

Unknown = 0

The codestream does not say, such as palette indices or a component count no color space has.

YCbCr = 3

Luma and two chroma components, not converted: a JPEG in YCbCr, or a JPEG 2000 file in sYCC.

Examples

// The values the codestream stores: no color conversion, no widening to 8 or 16 bits, signed samples kept signed.
SampleImage image = SampleImage.Load("duck.jpg");
Console.WriteLine($"{image.Color}, {image.Components.Count} components of {image.Components[0].Precision} bits");

// A YCbCr JPEG stays YCbCr: luma, then the two chroma samples of each pixel, at full resolution.
Span<int> row = image.Row(0);
int luma = row[0], cb = row[1], cr = row[2];