PiAPI Remove Background icon

PiAPI Remove Background

Remove the background from images using PiAPI

Overview

This node removes the background from images using an external image processing API. It supports inputting images either by URL or as binary data, then sends the image to the API for background removal. Users can optionally wait for the background removal task to complete before continuing the workflow, with configurable retry attempts and intervals.

Common scenarios include:

  • Preparing product photos for e-commerce by removing backgrounds.
  • Creating marketing materials where isolated subjects are needed.
  • Automating image editing workflows that require transparent backgrounds.

Example: A user provides a URL of a product image, the node processes it to remove the background, and outputs the processed image metadata or status for further use in the workflow.

Properties

Name Meaning
Image Input Method Method to input the image data. Options: URL (provide image URL), Binary Data (use binary image data).
Image Binary Property Name of the binary property containing the image data (used only if "Binary Data" is selected).
Image URL URL of the image to process (used only if "URL" is selected).
Image Requirements Notice about image format and size requirements: common formats like JPEG, PNG; max size 10MB.
Wait For Completion Whether to wait for the background removal process to complete before continuing.
Max Retries Maximum number of retries to check task status (shown only if waiting for completion).
Retry Interval Interval between retries in milliseconds (shown only if waiting for completion).

Output

The node outputs JSON objects representing the status or result of the background removal task:

  • If waiting for completion is disabled, output contains the task ID and current status (e.g., "pending").
  • If waiting for completion is enabled, output contains the final task status and related information once completed.
  • In case of errors, the output JSON includes error messages describing the issue.

No direct binary image data is output by this node; it primarily returns task metadata/status.

Dependencies

  • Requires an API key credential for the external image processing service ("PiAPI").
  • The node calls the API endpoint /api/v1/task with a payload specifying the model and task type for background removal.
  • Uses helper functions to handle binary data extraction and API requests.
  • No additional environment variables are explicitly required beyond the API credential.

Troubleshooting

  • Error: "The provided binary data is not an image"
    Occurs if the binary input does not have an image MIME type. Ensure the binary data is a valid image format.

  • Error: "Failed to get a valid task ID from the API"
    Indicates the API did not return a proper task identifier. Check API credentials and network connectivity.

  • Error: "The API could not process the provided image..."
    Happens when the image is inaccessible, unsupported format, or too large (>10MB). Verify image URL accessibility and format compliance.

  • Retries and timeouts
    When waiting for completion, if the task takes longer than expected, increase max retries or retry interval.

  • Continue on Fail
    If enabled, errors will be returned as part of the output JSON instead of stopping execution.

Links and References

Discussion