# AI Background Remover — BiRefNet, Bulk, Transparent PNG (`robinsiacreation/ai-background-remover`) Actor

Remove the background from product photos, portraits and logos with the BiRefNet AI model. Paste image URLs, get transparent PNG/WebP or white-background JPG links back. Keeps hair detail. Pay per image, no subscription.

- **URL**: https://apify.com/robinsiacreation/ai-background-remover.md
- **Developed by:** [Robin](https://apify.com/robinsiacreation) (community)
- **Categories:** AI, Integrations, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 background removed (per image)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## AI Background Remover — BiRefNet, bulk, transparent PNG

Remove the background from **product photos, portraits, pets, cars and logos** with BiRefNet, one of the most accurate open background-removal models. Paste image URLs, get clean cut-outs back — in bulk, through the API, or from your AI agent.

- **High quality:** keeps hair, fur and fine edges that simpler models (U²-Net) cut off.
- **Cheap:** pay only per successfully processed image. Failed URLs are never charged.
- **Bulk:** hundreds of images in one run. One broken link doesn't stop the batch.
- **E-commerce ready:** transparent PNG/WebP, or a solid white (or any color) background as JPG, with optional auto-crop to the product.
- **Full resolution:** the cut-out keeps the original image size (up to 25 MP).
- **No GPU, no subscription, no sign-up to another service.** Runs entirely on Apify.

### What is it good for?

| Use case | Example |
|---|---|
| E-commerce | White-background product photos for Amazon, Shopify, eBay, Etsy |
| Marketplaces | Clean up supplier or user-uploaded listing photos in bulk |
| Profile pictures | Cut out people for ID photos, team pages, avatars |
| Design | Stickers, thumbnails, collages, ads |
| Data pipelines | Chain after any scraper to get cut-outs of every product it finds |

### How to use it

1. Paste one or more **image URLs** (JPG, PNG, WebP, BMP).
2. Choose the **output format**: PNG or WebP (transparent) or JPG (solid background).
3. Optionally set a **background color** (e.g. `#FFFFFF`) and **crop to subject**.
4. Click **Start**. Each result row has a direct link to the cut-out image.

#### Input example

```json
{
  "imageUrls": [
    "https://example.com/sneaker.jpg",
    "https://example.com/portrait.png"
  ],
  "outputFormat": "png",
  "backgroundColor": "",
  "cropToSubject": true,
  "cropPaddingPercent": 5
}
```

#### Output example

```json
{
  "sourceUrl": "https://example.com/sneaker.jpg",
  "status": "ok",
  "error": null,
  "inputWidth": 1200,
  "inputHeight": 1200,
  "outputWidth": 980,
  "outputHeight": 760,
  "outputUrl": "https://api.apify.com/v2/key-value-stores/…/records/cutout-00001.png",
  "outputKey": "cutout-00001.png",
  "outputBytes": 845112
}
```

### Pricing

Pay per event: you are charged once per image whose background was removed successfully. Failed downloads or invalid images cost nothing. Set "Maximum cost per run" to cap spending — the Actor stops cleanly when it is reached.

### Tips

- Use **WebP** for much smaller transparent files, **PNG** for maximum compatibility.
- For marketplace listings use **JPG + `#FFFFFF` + crop to subject**.
- Images above 25 megapixels or 40 MB are rejected (not charged).
- Works best when there is one clear subject. Very busy scenes may keep parts of the background.

### Model and license

Uses **BiRefNet** (general, lite variant; MIT license) running on CPU with ONNX Runtime. Your images are processed inside your own Apify run and are not sent to any third-party service.

# Actor input Schema

## `imageUrls` (type: `array`):

Direct links to the images (JPG, PNG, WebP, BMP). One URL per line.

## `outputFormat` (type: `string`):

PNG and WebP keep transparency. JPG has no transparency, so the background color below is used (white by default).

## `backgroundColor` (type: `string`):

Hex color like #FFFFFF to put a solid background behind the subject (e.g. white for Amazon/Shopify listings). Leave empty for transparent.

## `cropToSubject` (type: `boolean`):

Trim empty space around the subject.

## `cropPaddingPercent` (type: `integer`):

Margin kept around the subject when cropping, as a % of its size.

## Actor input object example

```json
{
  "imageUrls": [
    "https://images.pexels.com/photos/1027130/pexels-photo-1027130.jpeg?auto=compress&cs=tinysrgb&w=940"
  ],
  "outputFormat": "png",
  "cropToSubject": false,
  "cropPaddingPercent": 5
}
```

# Actor output Schema

## `results` (type: `string`):

One row per input URL with status, size and download link.

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "imageUrls": [
        "https://images.pexels.com/photos/1027130/pexels-photo-1027130.jpeg?auto=compress&cs=tinysrgb&w=940"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("robinsiacreation/ai-background-remover").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "imageUrls": ["https://images.pexels.com/photos/1027130/pexels-photo-1027130.jpeg?auto=compress&cs=tinysrgb&w=940"] }

# Run the Actor and wait for it to finish
run = client.actor("robinsiacreation/ai-background-remover").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "imageUrls": [
    "https://images.pexels.com/photos/1027130/pexels-photo-1027130.jpeg?auto=compress&cs=tinysrgb&w=940"
  ]
}' |
apify call robinsiacreation/ai-background-remover --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,robinsiacreation/ai-background-remover"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Y1PJsl9U7lxdeLMbF/builds/Rxr251K8KEuLYpCep/openapi.json
