# Background Remover: Remove Background, Transparent PNG (`brasspage/background-remover`) Actor

Remove the background from images in bulk and get a transparent PNG or WebP. Optional white or color background and crop to subject, for product photos. Image URLs or a dataset in. $0.005 per image.

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

## Pricing

from $5.00 / 1,000 background removeds

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

### Background Remover: Remove Background, Make a Transparent PNG

Paste image links, upload a file, or point to a dataset of image URLs. Get each image back with the **background removed**, as a **transparent PNG** or WebP, or on a solid color like white. Crop to the subject if you want. **$0.005 per image.** Images that fail are free.

| You give it                                      | You get back                                  |
| ------------------------------------------------ | --------------------------------------------- |
| Image URLs (http or https)                       | `fileUrl`: a link to the cutout (PNG or WebP) |
| ...or one uploaded image, or a dataset           | `width`, `height` of the cutout               |
| Output format, background color, crop to subject | `outputBytes`, and an `error` if it failed    |

**Try it in one click.** The prefilled input removes the background from a museum photo of a pair of sneakers. Click **Start**. It costs $0.005 and the start fee.

### What it does

- **Remove background** from photos in bulk: products, people, pets, objects.
- **Transparent PNG** by default. **WebP** keeps the transparency and was 6 to 9 times smaller than PNG in our tests.
- **White or color background**: set `backgroundColor` to `#ffffff` for marketplace product photos (Amazon, eBay, Etsy, Shopify), or any hex color.
- **Crop to subject**: trims the empty margin so the product fills the picture.
- **Inputs**: JPG, PNG, WebP, AVIF, TIFF, GIF and BMP, by URL, upload, or a dataset (for example the output of a scraper).
- **No charge for failures**: an image that fails, or where no subject is found, gets an `error` field and is free.

### Where it is good, and where it is weak

It uses [rembg](https://github.com/danielgatis/rembg) with the **isnet-general-use** model, on CPU. We tested it on three public photos and looked at every result:

- **Product photo on a plain background** (sneakers on gray): clean edges, laces and soles kept. This is the best case.
- **Portrait** (curly hair, patterned chair behind): the person and most of the hair come out well. Fine hair strands at the edge are a bit soft, and a few pieces of the chair stayed in at the bottom corner.
- **Busy street scene** (a crowded market): poor. It kept three people in the front, cut holes in one of them, and left stray pieces. With no single clear subject, the model guesses.

Also weak: **glass, smoke and see-through objects** (they come out solid or vanish), and a subject that has the same color as the background. If you need perfect hair for print, check the result or touch it up.

### How to use

1. Open the Actor in the Apify Console. Keep the prefilled sample, or paste links to your own images.
2. Pick PNG or WebP. Add a background color or turn on **Crop to subject** if you want.
3. Click **Start**, then open the **Output** tab and click each cutout.

### Examples

**1. Product photo on white, cropped to the product:**

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG/1920px-Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG"
  ],
  "backgroundColor": "#ffffff",
  "cropToSubject": true
}
```

**2. Portrait to a transparent PNG:**

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/8/81/Smiling_senior_woman_with_curly_hair_portrait.jpg/1920px-Smiling_senior_woman_with_curly_hair_portrait.jpg"
  ],
  "outputFormat": "png"
}
```

**3. Small transparent WebP files (this busy scene shows the weak case):**

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/3/30/Busy_Street%2C_CMB_Market.jpg"
  ],
  "outputFormat": "webp"
}
```

To process every image in a dataset, use `"datasetId": "<dataset ID>"` instead of `imageUrls`. Set `"datasetUrlField"` if the image URL is not in a field named `url`, `imageUrl`, `image`, `src` or `fileUrl`.

### Output example

One dataset item per image:

```json
{
  "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Paar_herenschoenen...JPG",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/.../records/image-001-1920px-Paar_herenschoenen....png",
  "inputFormat": "JPEG",
  "outputFormat": "png",
  "backgroundColor": "#ffffff",
  "cropped": true,
  "width": 1559,
  "height": 1004,
  "outputBytes": 1511782,
  "processedAt": "2026-10-27T21:43:20+00:00"
}
```

The files are also in the run's key-value store as `image-NNN-<name>.png` (or `.webp`).

### Input

| Field             | Description                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------- |
| `imageUrls`       | Direct http or https links to images. Apify key-value store record URLs also work.            |
| `imageFile`       | Upload one image from your computer.                                                          |
| `datasetId`       | Process the image URL of every item in this dataset.                                          |
| `datasetUrlField` | The dataset field with the image URL. Empty: the first of url, imageUrl, image, src, fileUrl. |
| `outputFormat`    | `png` (default) or `webp`.                                                                    |
| `backgroundColor` | A hex color like `#ffffff`. Empty (default): transparent.                                     |
| `cropToSubject`   | Default off. On: cut the image down to the box around the subject.                            |
| `maxImagesPerRun` | Safety limit, default 1000. On the Apify free plan a run processes up to 25 images.           |

### Pricing

Pay per event. There is no monthly fee.

| Event                | Price                         |
| -------------------- | ----------------------------- |
| Actor start          | $0.00005 per run              |
| `background-removed` | $0.005 per image you get back |

Examples: 100 product photos cost about $0.50. 10,000 cost about $50. Set **Maximum cost per run** in the run options to cap your spending; the run stops before an image that would go over it.

### Limits

- Up to 25 MB and 40 megapixels per image, and 60 seconds per download.
- Speed: about 10 seconds to start and load the model, then about 4 seconds per 2 to 6 megapixel image at the default 4 GB of memory. In our test, 10 images took 54 seconds.
- The cutout keeps the full size of the input. Animated GIF and WebP: only the first frame. Multi-page TIFF: only the first page.
- On the Apify free plan, a run processes up to 25 images. To process more in one run, use a [paid Apify plan](https://apify.com/pricing).

### Security

Every image is treated as untrusted. Links are fetched over http or https only, and every redirect is checked so that no private or internal address is ever reached. Only the decoders for the formats listed above are used. Images that claim more than 40 megapixels are refused before they are decoded.

### FAQ

**What does it use?**
Free, open-source software: rembg (MIT) with the isnet-general-use model (MIT), run on CPU with ONNX Runtime, and Pillow. The model is built into the Actor, so nothing is downloaded at run time and your images are sent to no other service. It is an AI model, so results vary from image to image.

**Where do my images go?**
They are downloaded into the run, processed, and saved only in your own Apify storage.

**How do I use it from code or an AI agent?**
Call the Actor with the Apify API or the Apify MCP server, then read the dataset. MCP URL: `https://mcp.apify.com?tools=brasspage/background-remover`.

**Who is responsible for the rights to the images?**
You are. Only process images that you own or have permission to use.

### Issues and support

An image comes out wrong? Open an issue in the Actor's **Issues** tab, with the run URL if you have one. We check it every day and reply there.

### Related Actors

- [Image Converter & Compressor](https://apify.com/brasspage/image-converter): HEIC to JPG, WebP, AVIF and PNG, with compression.
- [PDF to Image & Image to PDF](https://apify.com/brasspage/pdf-to-image): render PDF pages as images, or join images into one PDF.

Made by Tack, an AI at Brasspage.

# Changelog

This Actor's version history is a separate document: https://apify.com/brasspage/background-remover/changelog.md

# Actor input Schema

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

Direct http or https links to images: JPG, PNG, WebP, AVIF, TIFF, GIF or BMP, up to 25 MB and 40 megapixels each. Apify key-value store record URLs also work.

## `imageFile` (type: `string`):

Upload one image from your computer, up to 25 MB.

## `datasetId` (type: `string`):

Optional. The ID (or username~dataset-name) of an Apify dataset, for example the output of a scraper. Each item's image URL is read from the field below.

## `datasetUrlField` (type: `string`):

Optional. The dataset field that holds the image URL. Empty: the first of url, imageUrl, image, src, fileUrl.

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

PNG is lossless and works everywhere. WebP files are about 5 to 10 times smaller and keep transparency.

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

Optional. A hex color like #ffffff puts the subject on a solid color (white for marketplace product photos). Empty keeps the background transparent.

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

On: cut the image down to the box around the subject, with no empty margin.

## `maxImagesPerRun` (type: `integer`):

Safety limit. The run stops after this many images and the last dataset row says so. On the Apify free plan a run processes up to 25 images.

## Actor input object example

```json
{
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG/1920px-Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG"
  ],
  "outputFormat": "png",
  "cropToSubject": false,
  "maxImagesPerRun": 1000
}
```

# Actor output Schema

## `images` (type: `string`):

One item per image: input URL, cutout file link, size in pixels and bytes. An image that fails has an error instead.

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

Key-value store with image-NNN-<name>.png or .webp for each image.

# 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/b/b2/Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG/1920px-Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("brasspage/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/b/b2/Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG/1920px-Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG"] }

# Run the Actor and wait for it to finish
run = client.actor("brasspage/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/b/b2/Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG/1920px-Paar_herenschoenen%2C_gympen%2C_rood_en_wit%2C_%E2%80%9CCorbeau%E2%80%9D%2C_objectnr_87248-1-2.JPG"
  ]
}' |
apify call brasspage/background-remover --silent --output-dataset

```

## MCP server setup

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