Skip to content

colormap#getLUT

Summary

colormap#getLUT returns a copy of the map's lookup table in packed RGBA8 order. By default the RGB bytes are sRGB. Request linear RGB when decoding the individual texels for numeric use.

Syntax

getLUT(colorSpace?: ColormapColorSpace): Uint8Array
const rgba = map.getLUT();

Parameters

Name Type Required Description
colorSpace "srgb" | "linear" No Defaults to "srgb". Linear output decodes the RGB channels and rounds them to bytes. Alpha bytes stay the same.

Returns

Uint8Array - Independent copy of width * 4 bytes. For GPU-only maps, the call throws.

Example

const map = WasmGPU.color.map.grayscale();
console.log(map.getLUT().slice(0, 4)); // [0, 0, 0, 255]

See Also