Skip to main content

Function: maskToEditMask()

maskToEditMask(masks, opts?): Promise<Buffer>

Defined in: packages/agentos/src/io/segmentation/consumers/maskToEditMask.ts:16

Combine one or more segmentation masks into a single mask Buffer suitable for editImage()'s mask input (white = edit region, black = keep).

Parameters​

masks​

one mask or many (unioned)

SegmentMask | SegmentMask[]

opts?​

height?​

number

optional canvas height; defaults to the first mask's.

target?​

"object" | "background"

'object' (default) edits the masked object; 'background' inverts so everything except the object is edited.

width?​

number

optional canvas width; defaults to the first mask's.

Returns​

Promise<Buffer>