# Background Remover - Image Converter, Compressor & Resizer (`tidytools/ai-image-toolkit`) Actor

Remove image backgrounds in bulk with AI (hair and fur kept): transparent PNG/WebP or any color, crop to subject. Plus resize, convert to WebP/AVIF/JPEG and compress.

- **URL**: https://apify.com/tidytools/ai-image-toolkit.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** AI, E-commerce, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

### What does AI Image Toolkit do?

**Paste image URLs, get back a download link for every result: background removed (transparent PNG/WebP or any color), resized, converted to WebP/AVIF/JPEG, or compressed. Background removal costs $0.005 per image, resize/convert/compress $0.002 per image (Free plan, no start fee). Failed images are free.**

Give it a list of images and pick one operation:

- ✂️ **Remove background (AI):** cut out people, products, animals and logos, hair and fur included. Get a **transparent PNG or WebP**, or the subject on **any background color** (white for marketplaces), optionally **cropped to the subject** with a margin.
- 📐 **Resize:** fit inside a box, fill and smart-crop (`cover` with automatic focus), pad to a square with a color, or stretch.
- 🔄 **Convert:** JPEG, PNG, WebP or AVIF; transparent areas become white (or your color) in JPEG.
- 🗜️ **Compress:** smaller files in the same format or as WebP/AVIF/JPEG. It never returns a larger file: if re-encoding does not help, you get the original back.

Images come from **URLs** (Google Drive, Dropbox and OneDrive share links work), from **another Actor's dataset** (for example a product scraper's image field), from **a key-value store** (files you uploaded) or as **base64**. Every result is saved as a file in the run's key-value store, and the dataset gets one row per image with a **download link** (`outputUrl`), the size, format and whether it was charged.

Background removal uses an AI segmentation model (BiRefNet, run on Cloudflare Images by our backend). Metadata such as EXIF and GPS is removed from every result.

### Who is it for?

- **E-commerce sellers and agencies:** white or transparent product photos for Amazon, Shopify, eBay and Etsy, in bulk, straight from your scraper's dataset.
- **Marketplaces and catalogs:** consistent square thumbnails (`resize` + `fit: pad`).
- **Design and print:** stickers, logos and cut-outs as transparent PNG/WebP.
- **Web performance:** convert image libraries to WebP or AVIF and compress them.
- **AI agents and automations:** one tool for "remove the background", "make it 1200×630", "convert to WebP".

### How much does it cost?

| Event | Price (Free plan) |
|---|---|
| Background removed | **$5.00 / 1,000 images** ($0.005 per image) |
| Image resized, converted or compressed | **$2.00 / 1,000 images** ($0.002 per image) |

Bigger Apify plans pay less: SILVER $0.0045 / $0.0018, GOLD and above $0.004 / $0.0016 per image. **No start fee.** Failed downloads, unsupported files, invalid lines and duplicates are free. The Actor runs on 512 MB and spends most of its time waiting for the image service, so platform usage is small (our test: 2 cut-outs in 5.2 s for $0.0005 of compute).

**Example:** 1,000 product photos with the background removed cost 1,000 × $0.005 = **$5.00** on the Free plan.

#### Price comparison (checked October 2026)

| Actor | Background removal price per image |
|---|---|
| **This Actor** | **$0.005** (and $0.002 for resize/convert/compress) |
| danitn11/birefnet-background-remover (same BiRefNet model family) | $0.01 → $0.007 |
| apivault_labs, seemuapps background removers | $0.01 |
| akash9078/ai-bg-remover | $0.025 |
| stefanie-rink/image-background-remover | $0.05 |
| dev00 background removers | $0.005 |

Image converters and compressors on the Store cost $0.0009–$0.015 per image (maximedupre/bulk-image-compressor $0.0009, marielise.dev/image-converter $0.002–$0.06 by size, eunit/sqoosh-image-compressor $0.015). Outside Apify, Photoroom's API charges $0.02 per background removal.

#### Control your cost

- **What is charged:** one event per image whose result was stored (the background-removal event or the cheaper utility event, depending on the operation).
- **What is free:** images that could not be downloaded or read, unsupported files (web pages, PDFs, SVG), invalid lines and duplicate URLs.
- At the start the Actor logs the worst-case cost ("Plan: 25 images × $0.005 = at most $0.125").
- **Max images** (default 1,000) caps a run. With a **maximum charge per run** set in the run options, the Actor stops starting new images when the limit would be passed; the images it did not process are listed in `SUMMARY.notProcessed` and the status message says so.

### How to use it

1. Choose **What to do** (Remove background, Resize, Convert format or Compress).
2. Paste image URLs, or pick a dataset or key-value store under **More input sources**.
3. Set the options for that operation (background color, crop, size, format, quality) and click **Start**.
4. Open the **Images (overview)** view and click the result links, or download all files from the key-value store.

#### Input example

```json
{
    "operation": "removeBackground",
    "imageUrls": [
        "https://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg/960px-Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg"
    ],
    "backgroundColor": "#ffffff",
    "cropToSubject": true,
    "cropMargin": 40,
    "maxSize": 2000
}
```

Leave out `backgroundColor` for a transparent PNG; set `"outputFormat": "webp"` for transparent files 3–5× smaller than PNG.

#### Output example (real run, 1 October 2026)

```json
{
    "index": 1,
    "input": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg",
    "operation": "removeBackground",
    "success": true,
    "outputUrl": "https://api.apify.com/v2/key-value-stores/RHb9MvsFd3ZZkxU7c/records/0002-960px-Cat03-nobg.png?signature=…",
    "outputKey": "0002-960px-Cat03-nobg.png",
    "format": "png",
    "width": 960,
    "height": 959,
    "bytes": 983802,
    "transparent": true,
    "savedPercent": -554.6,
    "inputFormat": "jpeg",
    "inputWidth": 960,
    "inputHeight": 959,
    "inputBytes": 150302,
    "warnings": [],
    "via": "backend",
    "charged": true,
    "durationMs": 2834
}
```

`savedPercent` is negative here because a transparent PNG of a photo is larger than the JPEG it came from. A failed image looks like this (not charged):

```json
{ "index": 1, "input": "https://upload.wikimedia.org/wikipedia/commons/thumb/x/xx/Nope.jpg/960px-Nope.jpg", "operation": "convert", "success": false, "error": "The image does not exist (HTTP 404). (not charged)", "errorType": "not_found", "charged": false }
```

#### What we measured (1 October 2026, our backend, public Wikimedia Commons images)

| Image | Operation | Result |
|---|---|---|
| Sneakers 960×638 | remove background, crop | 834×542 transparent PNG, clean laces, 5.5 s |
| Portrait with curly hair 960×1438 | remove background, WebP | curls kept without a halo, 195 KB, 6.3 s |
| Cat 960×959 | remove background, white, crop + margin | whiskers kept, 5.6 s |
| Photo 3831×5746, 9.8 MB | remove background, max 2048 px | 1365×2048 WebP 244 KB, 8.7 s |
| Same photo | compress (JPEG q75) | 9.8 MB → 3.0 MB (−70%), 4.7 s |
| Same photo | resize 1200×630, cover, auto focus | 118 KB, 6.6 s |
| Transparent PNG logo 960×1138 | convert to WebP | −86%, transparency kept |
| Website screenshot 1280×800 | remove background | not suitable: the white page is removed as background |

### Integrations

- **Product scrapers → white backgrounds:** run a scraper, then this Actor with **Dataset ID** set to its dataset and **Dataset field** to its image field (for example `images`, up to 100 URLs per item). Each row keeps `datasetItemIndex`.
- **Your own files:** upload images to a key-value store (Apify Console → Storage) and set **Key-value store with images**.
- **API:** call the Actor with `imagesBase64` (`{"id": "sku-17", "fileName": "shoe.jpg", "data": "<base64>"}`) and read `outputUrl` from the dataset.

### Use with AI agents (MCP)

Connect Apify's MCP server (https://mcp.apify.com?tools=tidytools/ai-image-toolkit) to Claude, Cursor or any MCP client, then ask e.g. "Remove the background of these three product photos and put them on white, cropped with a small margin."

```json
{ "operation": "removeBackground", "imageUrls": ["https://example.com/shoe.jpg"], "backgroundColor": "white", "cropToSubject": true, "cropMargin": 40 }
```

Failed images are not charged and carry an `errorType` (`not_found`, `blocked`, `unsupported`, `too_large`, `invalid_input`, `timeout`, `network`, `failed`).

### Advanced settings

- **Max images** (default 1,000): cost cap per run.
- **Parallel images** (default 4, up to 10).
- **Proxy:** only used when an image host refuses our servers; the Actor then downloads the image itself from Apify's network (`via: "actor-download"`).

### Limitations

- Input: JPEG, PNG, WebP or GIF (first frame only), up to **10 MB**, 50 megapixels and 12,000 px per side. AVIF, HEIC, TIFF, BMP, SVG and PDF are not accepted as input (AVIF is a valid output), and a link to a web page instead of the image file is reported as `unsupported`.
- Background removal needs a clear subject. **Screenshots, documents and scenes without a main subject do not work**; top-down shots of shiny objects can keep a faint halo; images under about 300×300 px get the warning `low_resolution`.
- AVIF is limited to 1,200 px per side: larger results are written as WebP (warning `avif_too_large_used_webp`). PNG results are limited to 16 megapixels: set **Max size** or use WebP.
- No AI upscaling: resizing up uses normal interpolation.
- Results stay in the run's key-value store for your Apify plan's data retention period; download what you need.

### Responsible use

Only process images you own or have the rights to edit. Cutting a person out of a photo does not change who owns the photo or the person's rights in it: do not use the results to impersonate anyone, to create misleading product listings or to remove watermarks or credits from other people's work. Images are processed only to produce your results; our backend keeps a 24-hour cache of results keyed by a hash of the image, so a repeated request is answered at once, and does not store the images otherwise.

### FAQ

**Does the Actor collect usage data?** The Actor sends one anonymous usage counter per run (input type, item count range, outcome) to improve the tool; no URLs, content or account data.

**How good are the edges?**
Good on hair, fur and whiskers in our tests (portraits, a cat, a dog, sneakers, a camera, a mug whose handle hole is cut out, logos). Weak spots are listed under Limitations.

**PNG or WebP?**
Both keep transparency. PNG is the most compatible but large (a 960 px cut-out is often 0.4–1 MB); WebP is usually 3–5× smaller.

**Is there a watermark or a resolution limit?**
No watermark. Images are processed at full resolution up to 50 megapixels; use **Max size** for smaller results.

**Why is a compressed image unchanged?**
It was already well compressed: re-encoding would have made it larger, so the original is returned (`unchanged: true`, warning `already_optimized`). PNG stays lossless with "Auto": choose WebP for big savings.

**What if my input is wrong (no images, a missing width, JPEG without a background color)?**
The run ends normally (not as failed) with one free error row in the dataset that says what to fix (`errorType: "invalid_input"`), and nothing is charged. Lines that are not image URLs get their own free error row; the other images are still processed.

**Do Google Drive, Dropbox and OneDrive links work?**
Yes, if the file is shared publicly ("anyone with the link") and is an image file. The Actor turns the share link into a download link itself; a private file or a folder link comes back as a free error row that says the link returned a web page.

**Where are my files?**
Every result is a file in the run's key-value store, named like `0001-shoe-nobg.png` (position, original name, operation). The dataset's `outputUrl` is a download link to it.

**Can I run it every day on new images?**
Yes: schedule it in Apify (Schedules) with your dataset or URL list; duplicates within one run are processed once.

**Where do I report a bad cut-out?**
Open an issue on the Actor's Issues tab with the image URL and your input.

# Actor input Schema

## `operation` (type: `string`):

removeBackground = cut out the subject with AI (transparent or colored background). resize = change the size. convert = change the format. compress = make files smaller. Background removal costs more than the other three.

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

Main input (fill this, or one of the optional sources below). Direct links to images (JPEG, PNG, WebP or GIF), up to 10 MB, 50 megapixels and 12,000 px per side each, one per line. Google Drive, Dropbox and OneDrive share links work. Lines that are not a URL are reported as invalid and not charged; the same URL twice is processed once.

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

auto = background removal: PNG (JPEG when a background color is set); resize and compress: the input's format; convert: WebP. PNG and WebP keep transparency. AVIF is limited to 1,200 px per side (larger results are written as WebP). Compress cannot output PNG.

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

Background removal: color behind the subject instead of transparency, e.g. #ffffff, f5f5f5, rgb(0,0,0) or white. Resize with fit "pad", and JPEG output of transparent images: the fill color (default white for JPEG).

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

Background removal only: trim the empty margin around the cut-out subject.

## `cropMargin` (type: `integer`):

With "Crop to the subject": pixels of margin kept around the subject.

## `maxSize` (type: `integer`):

Background removal, convert and compress: scale results down so the longest side is at most this many pixels (never up). Empty = keep the size.

## `width` (type: `integer`):

Resize only: target width. Give width, height or both.

## `height` (type: `integer`):

Resize only: target height.

## `fit` (type: `string`):

Resize only. contain = fit inside the box, keep the aspect ratio (may enlarge); scale-down = like contain, never enlarges; cover = fill the box and crop; crop = like cover, never enlarges; pad = fit inside and fill the rest with the background color (transparent by default); squeeze = stretch to the exact size.

## `gravity` (type: `string`):

Resize with fit cover or crop: which part to keep. auto = the most interesting area.

## `quality` (type: `integer`):

JPEG, WebP and AVIF quality (PNG is lossless). Empty = 90 for background removal, 85 for resize and convert, 75 for compress.

## `imageUrlSources` (type: `array`):

The same as "Image URLs", in the URL list editor: you can also upload or link a text/CSV file of image links.

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

Take image URLs from another Actor run's dataset (e.g. a product scraper's image field).

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

Field with the image URL, e.g. "imageUrl", or an array of image URLs such as "images" (up to 100 per item). Empty = the first URL field found.

## `keyValueStoreId` (type: `string`):

Process image files stored in a key-value store (for example files you uploaded). All records are used unless you list keys below; records that are not images are reported as failed and not charged.

## `keyValueStoreKeys` (type: `array`):

Only these records of the key-value store. Empty = all records.

## `imagesBase64` (type: `array`):

Images as base64 strings, data URLs (data:image/png;base64,...) or objects {"id": "sku-17", "fileName": "shoe.jpg", "data": "<base64>"} (id and file name are kept in the results). Mainly for API and AI-agent use.

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

Stop after this many images (a cost cap; the rest are listed in SUMMARY).

## `maxConcurrency` (type: `integer`):

How many images are processed at the same time.

## `proxyConfiguration` (type: `object`):

Only used when an image host refuses our servers and the Actor downloads the image itself. Apify proxy usage is billed to your Apify account.

## Actor input object example

```json
{
  "operation": "removeBackground",
  "imageUrls": [
    "https://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg/960px-Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg"
  ],
  "outputFormat": "auto",
  "cropToSubject": false,
  "cropMargin": 0,
  "fit": "contain",
  "gravity": "center",
  "maxImages": 1000,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

No description

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

No description

## `summary` (type: `string`):

No description

## `allColumns` (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/2/28/Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg/960px-Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/ai-image-toolkit").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/2/28/Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg/960px-Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tidytools/ai-image-toolkit").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/2/28/Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg/960px-Canon_EOS_5D_Mark_II_with_50mm_1.4_edit1.jpg",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/960px-Cat03.jpg"
  ]
}' |
apify call tidytools/ai-image-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidytools/ai-image-toolkit"
        }
    }
}
```

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/w3p8rtI51QdMqjtKr/builds/E3DYsh2IXeHzghzRD/openapi.json
