# Background Remover - transparent PNG cut-outs, 6 models (`superslowsloth/background-remover`) Actor

Remove the background from any image URL. Transparent PNG, WebP or flattened JPEG, six segmentation models, alpha matting for hair and fur.

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

## Pricing

from $40.00 / 1,000 image processeds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Background Remover — transparent PNG cut-outs from any image URL

Cuts the subject out of a photo and hands back a transparent PNG. Built on
[rembg](https://github.com/danielgatis/rembg) with six segmentation models,
running on CPU — no API key of your own, no GPU, no per-image SaaS subscription.

Paste a list of image URLs. Get back one cut-out file per image, plus a row
describing each one.

### Input

| Field | Type | Default | What it does |
|---|---|---|---|
| `imageUrls` | array | — | One image per entry. The same URL listed twice is downloaded and processed once. Up to 500 images per run. |
| `model` | select | `u2net` | `u2net` (general purpose), `u2netp` (lightweight, fastest), `u2net_human_seg` (people), `isnet-general-use` (sharper edges), `silueta` (small), `birefnet-general` (most accurate, slowest). |
| `outputFormat` | select | `png` | `png` (transparent, lossless), `webp` (transparent, smaller), `jpeg` (no alpha channel — the subject is flattened onto `backgroundColor`). |
| `alphaMatting` | boolean | `false` | A second refinement pass over the edge. Worth it for hair, fur and semi-transparent edges; several times the compute, and billed as its own event. |
| `backgroundColor` | string | \`\` | Hex colour to place behind the subject instead of transparency, e.g. `#ffffff`. Empty keeps it transparent. |
| `maskOnly` | boolean | `false` | Returns the black-and-white subject mask instead of the image, for pipelines that do their own compositing. |

JPEG cannot store transparency. Asking for one without a `backgroundColor`
flattens the subject onto white rather than failing the run, and the row says so.

### Output

The image goes to the run's key-value store — a dataset record is JSON and
cannot hold bytes — and each dataset row carries its URL:

```
index          position of the image in your input list
source_url     the image that was processed
image_url      the cut-out
model          the segmentation model used
output_format  png, webp or jpeg
alpha_matting  whether the refinement pass ran
billed_event   which event this row was charged under
width, height  pixels of the delivered image
output_bytes   size of the delivered file
```

### Billing

Pay per event: one charge per image, plus a small `actor-start` fee covering the
cold start and model load. The unit is the image rather than the pixel because
segmentation downscales to the model's own input size — a phone photo and a
print-resolution scan cost almost exactly the same, and charging per megapixel
would bill for a difference that is not there.

- A URL that does not download is not charged. Nothing of ours ran.
- A repeated URL is charged once.
- `alphaMatting` is charged as its own event, because it is a different amount
  of work, not a slower version of the same one.
- A run stops as soon as your spending limit is reached rather than continuing
  to work unpaid; everything produced before that point is in the dataset.

### Models and licences

All six models ship inside the image, so no weights are downloaded during your
run. `u2net`, `u2netp`, `u2net_human_seg` and `silueta` come from
[U-2-Net](https://github.com/xuebinqin/U-2-Net) (Apache-2.0),
`isnet-general-use` from [DIS](https://github.com/xuebinqin/DIS) (Apache-2.0),
and `birefnet-general` from [BiRefNet](https://github.com/ZhengPeng7/BiRefNet)
(MIT). rembg itself is MIT.

# Actor input Schema

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

One image per entry. Each is downloaded, cut out, and returned as a file URL in the dataset. The same URL listed twice is processed once. Up to 500 images per run.

## `model` (type: `string`):

Which model decides what the subject is. u2net is the general-purpose default; u2netp is a fifth of the size and faster on simple subjects; BiRefNet is the most accurate and the slowest.

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

PNG keeps transparency losslessly and is what most pipelines expect. WebP is transparent and much smaller. JPEG cannot store transparency at all, so the subject is flattened onto the background colour below.

## `alphaMatting` (type: `boolean`):

Runs a second refinement pass over the edge. Worth it for hair, fur and semi-transparent edges; several times the compute, and billed as its own event.

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

Hex colour to put behind the subject instead of transparency, e.g. #ffffff. Leave empty to keep the background transparent. Required in effect for JPEG, which has no alpha channel - white is used if this is empty.

## `maskOnly` (type: `boolean`):

Delivers the black-and-white subject mask rather than the image. Use it when your own pipeline does the compositing.

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/640px-Cat_November_2010-1a.jpg"
  ],
  "model": "u2net",
  "outputFormat": "png",
  "alphaMatting": false,
  "backgroundColor": "",
  "maskOnly": false
}
```

# Actor output Schema

## `cutouts` (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://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/640px-Cat_November_2010-1a.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("superslowsloth/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://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/640px-Cat_November_2010-1a.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("superslowsloth/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://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/640px-Cat_November_2010-1a.jpg"
  ]
}' |
apify call superslowsloth/background-remover --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,superslowsloth/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/b105wA550RIgr3cam/builds/UlC19T299NjftbnCo/openapi.json
