View as Markdown
Runware icon

Runware ACTION

Image Background Removal

Request an image background removal task to be processed by the Runware API. See the documentation.
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Runware account once, then configure and run Image Background Removal from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "runware-image-background-removal",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    runware: { authProvisionId: "apn_xxxxxxx" },
    inputImage: "Input Image",
    outputType: "Output Type",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Image Background Removal inputs
Property Type Description
inputImage Input Image string

Specifies the input image to be processed. The image can be specified in one of the following formats:

  • An UUID v4 string of a previously uploaded image or a generated image.
  • A data URI string representing the image. The data URI must be in the format data:<mediaType>;base64, followed by the base64-encoded image. For example: data:image/png;base64,iVBORw0KGgo....
  • A base64 encoded image without the data URI prefix. For example: iVBORw0KGgo....
  • A URL pointing to the image. The image must be accessible publicly. Supported formats are: PNG, JPG and WEBP.
Required
outputType Output Type string
Specifies the output type in which the image is returned.
Optional
outputFormat Output Format string
Specifies the format of the output image.
Optional
includeCost Include Cost boolean
If set to true, the cost to perform the task will be included in the response object. Defaults to false.
Optional
rgb RGB string[]
An array representing the [red, green, blue] values that define the color of the removed background. Eg. [255, 255, 255].
Optional
postProcessMask Post-Process Mask boolean
Flag indicating whether to post-process the mask. Controls whether the mask should undergo additional post-processing. This step can improve the accuracy and quality of the background removal mask.
Optional
returnOnlyMask Return Only Mask boolean
Flag indicating whether to return only the mask. The mask is the opposite of the image background removal.
Optional
alphaMatting Alpha Matting boolean
Flag indicating whether to use alpha matting. Alpha matting is a post-processing technique that enhances the quality of the output by refining the edges of the foreground object.
Optional
alphaMattingForegroundThreshold Alpha Matting Foreground Threshold integer
Threshold value used in alpha matting to distinguish the foreground from the background. Adjusting this parameter affects the sharpness and accuracy of the foreground object edges. Eg. 240.
Optional
alphaMattingBackgroundThreshold Alpha Matting Background Threshold integer
Threshold value used in alpha matting to refine the background areas. It influences how aggressively the algorithm removes the background while preserving image details. The higher the value, the more computation is needed and therefore the more expensive the operation is. Eg. 10.
Optional
alphaMattingErodeSize Alpha Matting Erode Size integer
Specifies the size of the erosion operation used in alpha matting. Erosion helps in smoothing the edges of the foreground object for a cleaner removal of the background. Eg. 10.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
runware-image-background-removal
Version
0.0.2
App
Runware
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes