Table of Contents

Class IndexedImage

Namespace
Egami.Quantization
Assembly
Egami.dll

An image as palette indices: one byte per pixel and the palette they index, for formats and APIs that want indexed color, such as a PDF indexed image. The indices are pooled; dispose the image to return them.

public sealed class IndexedImage : IDisposable
Inheritance
IndexedImage
Implements
Inherited Members

Examples

// Indices plus palette, for a PDF indexed-color image or a format of your own.
using IndexedImage indexed = photo.ToIndexed(new PaletteOptions { MaxColors = 64 });
byte[] lookup = [.. indexed.Palette.Colors.SelectMany(c => new[] { c.R, c.G, c.B })];
byte[] samples = indexed.Indices.ToArray();

Properties

Height

Gets the height in pixels.

public int Height { get; }

Property Value

int

Indices

Gets every index, row after row, Width per row.

public ReadOnlySpan<byte> Indices { get; }

Property Value

ReadOnlySpan<byte>

Exceptions

ObjectDisposedException

The image has been disposed.

Palette

Gets the palette the indices refer to.

public Palette Palette { get; }

Property Value

Palette

Width

Gets the width in pixels.

public int Width { get; }

Property Value

int

Methods

Dispose()

Returns the pooled indices.

public void Dispose()

Row(int)

Returns the indices of one row.

public ReadOnlySpan<byte> Row(int y)

Parameters

y int

The row.

Returns

ReadOnlySpan<byte>

The row's Width indices.

Exceptions

ArgumentOutOfRangeException

y is outside the image.

ObjectDisposedException

The image has been disposed.