Skip to main content

Interface: RemoveBackgroundOptions

Defined in: packages/agentos/src/io/segmentation/types.ts:211

Options accepted by the high-level removeBackground helper.

Example​

const { image } = await removeBackground({ image: 'https://example.com/hero.png' });
console.log(image.url); // the cut-out PNG on fal's CDN

Properties​

apiKey?​

optional apiKey: string

Defined in: packages/agentos/src/io/segmentation/types.ts:240

fal API key for this call, instead of FAL_API_KEY.


baseUrl?​

optional baseUrl: string

Defined in: packages/agentos/src/io/segmentation/types.ts:242

The provider's base URL for this call (fal: default https://fal.run).


format?​

optional format: BackgroundRemovalFormat

Defined in: packages/agentos/src/io/segmentation/types.ts:232

The cut-out's format. Default 'png'.


image​

image: string | Buffer | Uint8Array

Defined in: packages/agentos/src/io/segmentation/types.ts:220

The source image: an http(s) URL, or a base64 image data URL (standard, padded base64) whose bytes are PNG, JPEG, WebP or GIF, sent to the provider as given, or the image's bytes, sent as a data URL typed by their signature (PNG, JPEG, WebP or GIF). Any other string (a file path, raw base64, a data URL that holds no such image) is refused: read the file and pass its bytes.


model?​

optional model: string

Defined in: packages/agentos/src/io/segmentation/types.ts:224

The provider's model or endpoint. fal: default 'fal-ai/birefnet/v2'.


output?​

optional output: BackgroundRemovalOutput

Defined in: packages/agentos/src/io/segmentation/types.ts:230

'url' (default): the cut-out's URL on the provider's storage. 'buffer': its bytes and data URL; fal is asked to return the image inline (sync_mode), which also keeps it out of fal's request history.


provider?​

optional provider: BackgroundRemovalProviderId

Defined in: packages/agentos/src/io/segmentation/types.ts:222

Provider id. Defaults to 'fal'.


providerOptions?​

optional providerOptions: Record<string, unknown> | BackgroundRemovalProviderOptionBag

Defined in: packages/agentos/src/io/segmentation/types.ts:244

Provider-specific passthrough options, namespaced by provider id.


returnMask?​

optional returnMask: boolean

Defined in: packages/agentos/src/io/segmentation/types.ts:234

Also return the matte used for the cut (white = subject). Default false.


signal?​

optional signal: AbortSignal

Defined in: packages/agentos/src/io/segmentation/types.ts:238

Aborts the call; it then rejects with the signal's reason.


timeoutMs?​

optional timeoutMs: number

Defined in: packages/agentos/src/io/segmentation/types.ts:236

How long the call may take, download included, in milliseconds. Default 60000.