Skip to content

SixelEncoder

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Encodes pixel data to Sixel graphics format.

csharp
public static class SixelEncoder

Inheritance

ObjectSixelEncoder

Methods

Encode(byte[], int, int)

Encodes raw RGBA byte array to sixel.

Parameters:

  • rgbaPixels (Byte[]): RGBA pixel data (4 bytes per pixel).
  • width (Int32): Image width in pixels.
  • height (Int32): Image height in pixels.

Returns: String

The sixel-encoded string.

csharp
public static string Encode(byte[] rgbaPixels, int width, int height)

Encode(SixelPixelBuffer)

Encodes a pixel buffer to a sixel payload string.

Parameters:

Returns: String

The sixel-encoded string (DCS ... ST format).

csharp
public static string Encode(SixelPixelBuffer buffer)

Fields

MaxPaletteColors

Maximum number of colors in the sixel palette.

Returns: Int32

csharp
public const int MaxPaletteColors = 256

Remarks

Sixel is a bitmap graphics format used by terminals. Each "sixel" character encodes a 1×6 pixel column. This encoder takes RGBA pixel data and produces a sixel payload string that can be embedded in terminal output.

The encoder handles: Color palette quantization (max 256 colors)Transparency (transparent pixels are not drawn)Run-length encoding for compression

Released under the MIT License.