# Background Remover: AI Bulk Cutout & Transparent PNG (`bossless/background-remover`) Actor

High-precision AI background removal in bulk: turns photos and product pictures into transparent PNGs, crisp white e-commerce backgrounds, or custom colors. Crop to subject, extract masks, and export directly to cloud storage. Fast CPU inference, pay per image.

- **URL**: https://apify.com/bossless/background-remover.md
- **Developed by:** [Alexander Daskalov](https://apify.com/bossless) (community)
- **Categories:** AI, Developer tools, E-commerce
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 image cutouts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: AI Bulk Cutout & Transparent PNG

**High-precision AI background removal in bulk:** turn product photos, portraits, and images into crisp transparent PNGs, clean white e-commerce backgrounds, or custom colors.

Paste public image links (or share links from Google Drive and Dropbox) or connect directly to upstream scrapers via dataset chaining. Output files are automatically saved to permanent Key-Value Store records with direct public URLs, avoiding bloated dataset payloads.

- ✂️ **Hair-level boundary precision:** powered by state-of-the-art **IS-Net (1024x1024)** dichotomous image segmentation. Captures individual hair strands, animal fur, fine whiskers, and sharp product contours.
- 🛍️ **E-commerce ready:** replace busy backgrounds with crisp white (`#ffffff`) or any hex color for Shopify, Amazon, eBay, or Etsy listings.
- 📐 **Automatic crop-to-subject:** automatically detects the subject's bounding box and crops the canvas tightly around it, with customizable padding percentage.
- 🎭 **Alpha mask export:** optionally export the 8-bit black-and-white segmentation mask alongside the cutout image.
- 🔗 **Dataset chaining:** pipe image URLs directly from Instagram, Google Maps, Amazon, or e-commerce scrapers via `datasetId`.
- ⚡ **Zero setup & no GPU fees:** runs on high-throughput optimized CPU containers. No external API keys or third-party accounts required.

***

### What can you do with it?

- **E-commerce & retail catalogues:** transform studio and supplier photos into uniform white-background images with consistent margins.
- **Portraits & headshots:** generate transparent PNG cutouts for team pages, profile photos, and design mockups.
- **Graphic design & marketing:** isolate objects, food, cars, and merchandise in bulk for marketing creatives and ad banners.
- **Automated scraping pipelines:** chain downstream of marketplace scrapers to automatically clean product imagery.
- **AI agents & computer vision:** pre-process image datasets by segmenting foreground subjects and extracting alpha masks.

***

### What files does it accept?

| Input | Example | Supported |
|---|---|---|
| Direct image link | `https://example.com/photos/sneaker.jpg` | ✅ JPG, PNG, WebP, GIF, TIFF, BMP |
| Google Drive file | `https://drive.google.com/file/d/.../view` | ✅ Shared as "Anyone with the link" |
| Dropbox file | `https://www.dropbox.com/s/.../photo.png?dl=0` | ✅ Shared public link |
| Apify dataset | Upstream scraper dataset ID + field path | ✅ Auto-extracts image URLs |

*Note: Folders and pages requiring login are not supported. Link the image files directly.*

***

### How much does it cost?

Pay per successfully processed image. No monthly subscriptions, no seat fees.

| Event | Free / Bronze | Silver | Gold / Plat / Diamond |
|---|---|---|---|
| **Image cutout (`image`)** | **$0.008** / image | **$0.007** / image | **$0.006** / image |
| Actor start (`apify-actor-start`) | $0.00005 / run | $0.00005 / run | $0.00005 / run |

- **Fair billing:** Dead, unreadable, or private links are never charged. You only pay for images successfully segmented and delivered.
- **Cap your spend:** Set `maxImages` or use Apify's run budget cap to prevent unexpected costs.

***

### Input Options

| Field | Type | Default | Description |
|---|---|---|---|
| `images` | Array | `[...]` | List of public image URLs or share links (one per line). |
| `backgroundColor` | String | `"transparent"` | `"transparent"` (default), `"white"`, or hex code like `"#ffffff"`, `"#f5f5f5"`. |
| `outputFormat` | Select | `"png"` | `"png"` (best for transparency), `"jpeg"` (for solid backgrounds), or `"webp"`. |
| `cropToSubject` | Boolean | `false` | Automatically crop canvas tightly to the subject. |
| `paddingPercent` | Integer | `0` | Percentage padding (0–50%) around the cropped subject. |
| `returnMask` | Boolean | `false` | Save 8-bit black-and-white segmentation mask to KV Store. |
| `model` | Select | `"isnet"` | `"isnet"` (1024x1024 precision) or `"u2net"` (320x320 fast bulk). |
| `datasetId` | String | `""` | Apify dataset ID to chain images from. |
| `datasetField` | String | `"url"` | Field path in dataset containing image link (e.g. `"imageUrl"`). |
| `maxImages` | Integer | `100` | Maximum images to process in this run. |

***

### Example Usage

#### 1. Web Console / JSON Input

```json
{
  "images": [
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-portrait.jpg"
  ],
  "backgroundColor": "transparent",
  "outputFormat": "png",
  "cropToSubject": true,
  "paddingPercent": 5,
  "returnMask": false
}
```

#### 2. Python Client

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run_input = {
    "images": ["https://example.com/shoe.jpg"],
    "backgroundColor": "white",
    "outputFormat": "jpeg",
    "cropToSubject": True,
    "paddingPercent": 10
}

run = client.actor("bossless/background-remover").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print("Cutout URL:", item["recordUrl"])
    print("Dimensions:", item["width"], "x", item["height"])
```

#### 3. cURL

```bash
curl "https://api.apify.com/v2/acts/bossless~background-remover/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "images": ["https://example.com/portrait.jpg"],
    "backgroundColor": "transparent",
    "outputFormat": "png"
  }'
```

***

### Output Format

Each processed image produces a clean record in the default dataset:

```json
{
  "url": "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
  "status": "success",
  "recordUrl": "https://api.apify.com/v2/key-value-stores/abc123xyz/records/cutout_00001.png",
  "maskUrl": null,
  "width": 1024,
  "height": 768,
  "format": "png",
  "backgroundColor": "transparent",
  "cropped": true,
  "subjectBbox": [82, 114, 940, 680],
  "processedAt": "2026-10-29T12:00:00Z",
  "error": null
}
```

The `recordUrl` is a permanent, public download link directly to the image file in the run's Key-Value Store.

***

### Frequently Asked Questions

##### How does it compare to remove.bg or cloud APIs?

Most background removal APIs charge $0.20 to $0.90 per image and require monthly contracts. This actor runs local ONNX deep learning neural networks at just **$0.008 down to $0.006 per image** with zero monthly fees.

##### Are my images kept private?

Images are fetched and processed ephemerally inside your dedicated run container. Files are stored in your run's private Key-Value Store under your Apify account.

##### Can I use this with Claude Code or AI Agents via MCP?

Yes! You can invoke this actor from any MCP-compatible agent using the Apify MCP server to perform automated background removal and image editing within agentic workflows.

##### Notice of Non-Affiliation

This actor is an independent utility developed for the Apify platform. It is not affiliated with, endorsed by, or sponsored by remove.bg, Adobe, Kaleido, or any other commercial image processing service.

# Actor input Schema

## `images` (type: `array`):

Public direct image links (JPG, PNG, WebP) or share links from Google Drive and Dropbox shared as 'Anyone with the link'. One URL per line.

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

Optional Apify dataset ID to read images from (e.g., from an upstream scraper or crawler). Links in 'images' are processed first.

## `datasetField` (type: `string`):

Dotted path to the image link in each dataset item (e.g. 'url', 'imageUrl', 'images\[\*].url').

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

'transparent' (default, produces transparent PNG/WebP), 'white', or any hex code (e.g. '#ffffff', '#f5f5f5', '#000000').

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

Image format to save. Note: JPEG does not support transparency and defaults to white background.

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

Automatically crop the output image tightly around the detected subject's bounding box.

## `paddingPercent` (type: `integer`):

When 'cropToSubject' is enabled, add this percentage of breathing room around the subject.

## `returnMask` (type: `boolean`):

Save the 8-bit black-and-white segmentation mask to the Key-Value Store alongside the cutout image.

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

IS-Net runs at full 1024x1024 resolution with fine edge and hair detail. U2-Net runs at 320x320 for maximum throughput.

## `maxImages` (type: `integer`):

Stop after processing this many images. Caps the total cost of a run.

## Actor input object example

```json
{
  "images": [
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-portrait.jpg"
  ],
  "datasetField": "url",
  "backgroundColor": "transparent",
  "outputFormat": "png",
  "cropToSubject": false,
  "paddingPercent": 0,
  "returnMask": false,
  "model": "isnet",
  "maxImages": 100
}
```

# Actor output Schema

## `results` (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 = {
    "images": [
        "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
        "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-portrait.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bossless/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 = { "images": [
        "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
        "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-portrait.jpg",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("bossless/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 '{
  "images": [
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-product.jpg",
    "https://api.apify.com/v2/key-value-stores/T5HtoeQYut1ufwkKC/records/bgremove-portrait.jpg"
  ]
}' |
apify call bossless/background-remover --silent --output-dataset

```

## MCP server setup

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