Skip to main content

Function: buildDisplacementMap()

buildDisplacementMap(image): RgbaImage

Defined in: src/generative/BackgroundKeyer.ts:84

Builds a grayscale displacement map from a keyed image: background pixels (alpha 0) become black (no displacement) and subject pixels become their luminance. Masking by alpha keeps the transparent background from displacing into stray geometry. The result is opaque RGBA.

Parameters​

image​

RgbaImage

A keyed RGBA image (background already at alpha 0).

Returns​

RgbaImage

A new opaque RgbaImage usable as a displacement/bump map.