Raxol.Terminal.ANSI.SixelDithering (Raxol v2.3.0)

View Source

Dithering algorithms for Sixel image color quantization.

Operates on a SixelGraphics struct that has a populated pixel_buffer (palette indices) and palette (index -> {r,g,b} map). Reconstructs the RGB color grid, applies the chosen dithering algorithm, and re-maps pixels to palette indices.

Supported algorithms:

  • :floyd_steinberg -- error diffusion (best quality, serial scan)
  • :ordered -- Bayer 4x4 threshold matrix (fast, deterministic pattern)
  • :random -- random noise perturbation (fast, non-deterministic)

Summary

Functions

Applies the specified dithering algorithm to the image.

Functions

apply(image, arg2)

Applies the specified dithering algorithm to the image.

Returns the image with an updated pixel_buffer and dithering_algorithm flag. Images with empty pixel_buffer or palette are returned with only the flag set.