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)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "runware-image-background-removal",
"configured_props": {
"runware": { "authProvisionId": "apn_xxxxxxx" },
"inputImage": "Input Image",
"outputType": "Output Type"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "runware",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "runware-image-background-removal",
arguments: {
inputImage: "Input Image",
outputType: "Output Type",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| 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:
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
- Source
- View on GitHub ↗