# AI Image Background Remover (`ohs999/image-background-remover`) Actor

Remove image backgrounds in bulk with AI and get transparent PNG cutouts, white-background product photos or masks. Runs open-source models inside the Actor: no third-party API, no subscription, your images never leave the run.

- **URL**: https://apify.com/ohs999/image-background-remover.md
- **Developed by:** [OHS Data](https://apify.com/ohs999) (community)
- **Categories:** AI, Automation, E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.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?

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 Image Background Remover

Remove the background from images in bulk and get clean cutouts you can use right away.

- **Transparent PNG / WebP cutouts** of people, products, animals and objects
- **Product photos on a solid color**: set `backgroundColor` to `#FFFFFF` for marketplace-ready white backgrounds, or export JPG
- **Crop to subject** to trim empty space, and optionally get the **black-and-white mask**
- Two models: **quality** (IS-Net, cleaner edges) and **fast** (U²-Net, about 3x faster)
- Runs open-source models inside the Actor: no third-party API, no subscription, no API key, and your images never leave the run

Typical uses: e-commerce product listings, catalog cleanup, profile photos, design assets, preparing training data, and image pipelines run by AI agents.

### Input

```json
{
  "imageUrls": ["https://example.com/product-1.jpg", "https://example.com/product-2.png"],
  "model": "quality",
  "outputFormat": "png",
  "backgroundColor": "",
  "cropToSubject": false,
  "returnMask": false
}
```

Images must be direct links to JPG, PNG or WebP files, up to 25 MB and 50 megapixels each.

### Output (one row per image)

| field | example | meaning |
|---|---|---|
| `outputUrl` | https://api.apify.com/v2/key-value-stores/…/records/00000-….png | the cutout, ready to download |
| `imageUrl` | https://example.com/product-1.jpg | the original link |
| `width` / `height` | 1200 / 900 | size of the result |
| `maskUrl` | null | the mask, when `returnMask` is on |
| `error` | null | why an image could not be processed |

Results are stored in the run's key-value store, so they follow your Apify data retention settings.

### Pricing

You pay per successfully processed image, about **$5 per 1,000 images**. Images that fail to download or open are free, and the mask costs nothing extra. The run stops automatically at your spending limit.

### FAQ

**Are my images sent anywhere?** No. The AI models are bundled inside the Actor, so images are only downloaded from the links you give and processed in the run.

**Which model should I use?** Start with `quality`. Use `fast` for large batches where speed matters more than fine edges such as hair.

**Can I process any file?** Only process images and documents you own or have permission to use. The Actor does not check rights for you.

**How do I call it from code or an AI agent?** Use the Apify API or the Apify MCP server with the input shown above; each dataset row links to the finished image.

### Credits

Built with [rembg](https://github.com/danielgatis/rembg) (MIT), [IS-Net / DIS](https://github.com/xuebinqin/DIS) (Apache-2.0) and [U²-Net](https://github.com/xuebinqin/U-2-Net) (Apache-2.0). Not affiliated with their authors.

The sample image in the input form is "Tabby cat with blue eyes" by AdinaVoicu (CC0, via Wikimedia Commons).

# Actor input Schema

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

Direct links to JPG, PNG or WebP images (up to 25 MB and 50 megapixels each).

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

"quality" (IS-Net) gives cleaner edges; "fast" (U²-Net) is about 3x faster. Both cost the same.

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

PNG and WebP keep transparency. JPG always gets a background color (white unless you set one).

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

Optional hex color such as #FFFFFF to put behind the subject, for example for product photos. Leave empty for transparency.

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

Trim empty space around the subject.

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

Save the black-and-white mask as a separate PNG (no extra charge).

## Actor input object example

```json
{
  "imageUrls": [
    "https://api.apify.com/v2/key-value-stores/bleIYCdyl2nnhq1os/records/tabby-cat-960.jpg"
  ],
  "model": "quality",
  "outputFormat": "png",
  "cropToSubject": false,
  "returnMask": false
}
```

# 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 = {
    "imageUrls": [
        "https://api.apify.com/v2/key-value-stores/bleIYCdyl2nnhq1os/records/tabby-cat-960.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ohs999/image-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://api.apify.com/v2/key-value-stores/bleIYCdyl2nnhq1os/records/tabby-cat-960.jpg"] }

# Run the Actor and wait for it to finish
run = client.actor("ohs999/image-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://api.apify.com/v2/key-value-stores/bleIYCdyl2nnhq1os/records/tabby-cat-960.jpg"
  ]
}' |
apify call ohs999/image-background-remover --silent --output-dataset

```

## MCP server setup

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