# Background Remover — Transparent PNG Cutouts in Bulk (`ponderable_hydrometer/remove-background`) Actor

Image background remover: remove the background (remove bg) from product photos, portraits and objects in bulk. Background removal gives transparent PNG cutouts, or the subject on white or a custom colour, using the open U²-Net-P model. Pass image links, no API key.

- **URL**: https://apify.com/ponderable_hydrometer/remove-background.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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 — Transparent PNG Cutouts in Bulk

**Clean cutouts for catalogues, ads and profile pictures, in bulk.** Pass a list of image links and get each picture back as a PNG with the background removed (transparent), or with the subject on white or another colour for marketplaces. The open U²-Net-P model runs inside the Actor, so there is no per-image API fee and no key.

### What you can do with it

- **Prepare product photos** for a catalogue, a shop or a marketplace listing: transparent or plain white background.
- **Make cutouts for ads, banners and thumbnails** from portraits and objects.
- **Clean up a folder of profile pictures** in one run.
- **Replace a paid remove-background API** for simple, clearly separated subjects.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `imageUrls` | array | — | Direct links to JPEG, PNG or WebP images. |
| `background` | string | `transparent` | `transparent` or a colour like `#ffffff` or `white`. An invalid colour fails the run immediately, before the model loads, so it costs almost nothing. |
| `maxSide` | integer | `2048` | Scale larger images down so the longest side is at most this many pixels (256 to 6000). Smaller images are not enlarged. |

Example: `{"imageUrls": ["https://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg"], "background": "#ffffff"}`

### What you get

One row per image: `imageUrl`, `fileUrl` (the PNG in the run's key-value store), `width`, `height`, `background`, `foregroundPercent` (share of the image kept), `bytes`. Files are named `cutout-1.png`, `cutout-2.png` and so on, in input order. The output is always a PNG.

### Output sample

```json
{
  "imageUrl": "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/abc/records/cutout-1.png",
  "width": 640,
  "height": 853,
  "background": "transparent",
  "foregroundPercent": 41,
  "bytes": 412233
}
```

### Use it from the API or an AI agent

Start a run and read the results back in one HTTP call:

```bash
curl -X POST "https://api.apify.com/v2/acts/ponderable_hydrometer~remove-background/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"imageUrls": ["https://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg"]}'
```

AI agents can call it through the Apify MCP server: `https://mcp.apify.com?tools=ponderable_hydrometer/remove-background`.

### How it works

Each image is downloaded, rotated by its EXIF orientation, scaled down if needed, and passed to the U²-Net-P model (the small, fast variant of U²-Net), which finds the main subject. The result becomes the alpha channel of the PNG. The model runs on the Actor's own CPU; no image is sent to any other service.

### Limits and good to know

- **Works best with one clear subject.** Busy scenes or several subjects may keep or drop the wrong parts.
- **Soft edges.** The model works on a small 320 px mask that is scaled back up to the image size, so fine hair, fur, glass and other transparent objects get soft or imprecise edges. Check results before using them for print or high-end retouching.
- **No manual refinement,** no shadow or background replacement with a picture; only transparent or one solid colour.
- **Images that cannot be downloaded or decoded** produce no row and no result fee; the run log says why. If no image can be processed, the run ends as FAILED.
- **Files live in the run's key-value store,** so download them or copy them elsewhere if you need to keep them beyond your Apify storage retention.
- U²-Net is Apache 2.0, so cutouts can be used commercially.

### FAQ

**Do I need an API key?** No.

**Can I upload files instead of links?** Not directly: the Actor takes direct image links. Host the files anywhere that serves them over HTTP(S).

**How do I get a white background?** Set `background` to `#ffffff`.

### Pricing

Pay per result — **$3.00 per 1,000 results** (one image = one result), plus Apify's standard per-run start event ($0.00005 per GB of memory, so a fraction of a cent per run). No subscription.

# Actor input Schema

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

Direct links to JPEG, PNG or WebP images.

## `background` (type: `string`):

"transparent", or a colour such as "#ffffff".

## `maxSide` (type: `integer`):

Larger images are scaled down to this size.

## Actor input object example

```json
{
  "imageUrls": [
    "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg",
    "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/car-1.jpg",
    "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png"
  ],
  "background": "transparent",
  "maxSide": 2048
}
```

# Actor output Schema

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

All rows produced by this run, as JSON.

# 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://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg",
        "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/car-1.jpg",
        "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/remove-background").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://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg",
        "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/car-1.jpg",
        "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/remove-background").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://raw.githubusercontent.com/danielgatis/rembg/main/examples/animal-1.jpg",
    "https://raw.githubusercontent.com/danielgatis/rembg/main/examples/car-1.jpg",
    "https://raw.githubusercontent.com/xinntao/Real-ESRGAN/master/inputs/children-alpha.png"
  ]
}' |
apify call ponderable_hydrometer/remove-background --silent --output-dataset

```

## MCP server setup

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

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/XenhJxl4iHjKAkKO4/builds/iQybMsTUxtxanJ5d3/openapi.json
