Skip to main content

Function: contentBounds()

contentBounds(rgba, width, height, maskRgba?): Rect | undefined

Defined in: src/lib/transform/Transformer/index.ts:50

Bounding box of the visible pixels (alpha above 0), optionally only where a mask is also above 0.

Parameters​

rgba​

ArrayLike<number>

image data, 4 bytes per pixel

width​

number

height​

number

maskRgba?​

ArrayLike<number>

mask image data (alpha = mask value), same size

Returns​

Rect | undefined

Example​

contentBounds(imageData.data, 100, 100); // { x: 10, y: 20, width: 30, height: 5 }