Blog

AI Photos Background Remover (2026): Tools, Cost and Code

Unicorn API Team · · 11 min read

AI photos background remover turning a sneaker photo on a cluttered table into a transparent PNG cutout

An AI photos background remover takes a picture, finds the subject (a person, a product, a pet) and erases everything else, leaving a transparent image you can place on any new backdrop. The free web tools that rank for this search all work the same way: upload, wait a few seconds, download. That is fine for one photo. It falls apart when you have 400 product shots, a client folder that refreshes every week, or an app where users upload their own pictures. This guide explains how the technology works, when a free tool is enough, and how to run the same job through an API for about a cent per image, with code you can paste and run today.

How does an AI photos background remover work?

Under the hood, an AI photos background remover is an image segmentation model. Segmentation means labelling every pixel in a picture: this pixel belongs to the dog, that pixel belongs to the sofa behind it. The model has been trained on large numbers of photos where people traced the subject by hand, so it has learned what “the main thing in the picture” usually looks like, even when the background is busy.

That answers a question people ask on forums surprisingly often: is the one-click “Remove Background” button really AI? In almost every current tool, yes. Before neural networks, you had two options. The magic wand selected pixels of a similar colour, and chroma keying (the green-screen trick) deleted one specific colour. Both follow fixed rules, so both fail when the subject’s shirt matches the wall. A trained model judges shape and context, not just colour.

Segmentation versus matting

A plain segmentation gives a hard yes/no mask. That is fine for a cardboard box, but it makes hair, fur, lace and motion blur look cut out with scissors. Better removers add a second stage called matting. A matte stores a value from fully transparent to fully opaque for each pixel, so a wisp of hair can be 40% visible and blend into whatever you put behind it. When people praise a tool for “sharp edges”, what they are really praising is the quality of its matte.

Why the result is a PNG

Transparency lives in the alpha channel, a fourth value stored next to red, green and blue for every pixel. PNG and WebP support an alpha channel; JPEG does not. That is why every AI image background remover hands you a PNG. If you open the result and save it as JPEG, the transparent areas get filled with a solid colour (usually white or black) and the soft edge information is gone for good.

Free online tools vs an API: which do you need?

The search results for this keyword are dominated by free web tools, and many people also use the remover built into design apps such as Adobe Express or mobile apps such as Pixelcut. For a profile picture or a single listing photo, any of them is the fastest route. The question is what happens as volume, privacy or automation start to matter.

NeedFree web toolPhone or design appAPI
SetupNoneInstall, sign inAPI key and a short script
Best volumeOne to a few imagesA few to dozensDozens to many thousands
AutomationManual upload each timeSome batch features, still manualFully scriptable, runs on a schedule or on upload
Output limitsCheck for resolution caps and watermarksOften tied to a subscription tierDefined per request, priced before you run it
Cost modelFree with limits, or paid downloadsSubscriptionPay per image
Inside your own productNoNoYes

A rule of thumb that holds up: if you will do this more than a few dozen times a month, or the photos come from somewhere other than your own camera roll (a supplier feed, a CMS, user uploads), an API pays for itself in saved clicks within the first afternoon. An AI powered background remover behind an API also means the same model handles every image, so a whole catalogue gets consistent edges instead of a mix of results from whichever tool someone happened to open.

Privacy is the other deciding factor. With a free site, read the terms to see what happens to uploads. With an API you choose exactly which images leave your system and when.

Diagram comparing a web tool, a phone app and an API for removing photo backgrounds at different volumes
Free tools fit one-off edits; an API fits batches and automated workflows.

How to remove photo backgrounds with an API, step by step

On Unicorn API, the dedicated model for this job is Recraft Remove Background. It takes one input field, image, and returns a cutout. It costs 1 credit per output image. Media models on Unicorn API run as jobs: you submit a job, poll it until it finishes, then download the result. Here is the whole flow.

  1. Create an API key on the keys page and export it as UNICORN_API_KEY.
  2. Make sure your photo is reachable by the API, typically as a public URL (the API documentation lists the input forms each model accepts).
  3. POST a job with the model id and the image.
  4. Poll the job until its status is succeeded.
  5. Download the file at outputs[0].url and store it as PNG.

One photo with curl

curl -X POST https://api.unicornapi.net/v1/jobs \
  -H "Authorization: Bearer $UNICORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"recraft-remove-background","input":{"image":"https://example.com/photos/sneaker.jpg"}}'

# The response includes a job id. Poll it:
curl https://api.unicornapi.net/v1/jobs/JOB_ID \
  -H "Authorization: Bearer $UNICORN_API_KEY"
# When "status" is "succeeded", the cutout is at outputs[0].url

A whole folder of photos with Python

This script takes a list of image URLs, runs a few jobs in parallel, waits for each to finish and saves every cutout to disk. It is the core of most batch workflows: point it at a product feed export and you have a full set of transparent PNGs.

import os
import time
import requests
from concurrent.futures import ThreadPoolExecutor

API = "https://api.unicornapi.net"
HEADERS = {"Authorization": f"Bearer {os.environ['UNICORN_API_KEY']}"}


def remove_background(image_url: str, max_wait: int = 300) -> str:
    """Submit a background removal job and return the output URL."""
    resp = requests.post(
        f"{API}/v1/jobs",
        headers=HEADERS,
        json={
            "model": "recraft-remove-background",
            "input": {"image": image_url},
        },
        timeout=30,
    )
    resp.raise_for_status()
    job_id = resp.json()["id"]

    deadline = time.time() + max_wait
    while time.time() < deadline:
        job = requests.get(f"{API}/v1/jobs/{job_id}", headers=HEADERS, timeout=30).json()
        if job["status"] == "succeeded":
            return job["outputs"][0]["url"]
        if job["status"] == "failed":
            raise RuntimeError(f"Job {job_id} failed: {job}")
        time.sleep(2)
    raise TimeoutError(f"Job {job_id} did not finish in {max_wait}s")


def process(item):
    name, url = item
    out_url = remove_background(url)
    data = requests.get(out_url, timeout=60).content
    path = os.path.join("cutouts", f"{name}.png")
    with open(path, "wb") as f:
        f.write(data)
    return path


if __name__ == "__main__":
    os.makedirs("cutouts", exist_ok=True)
    photos = {
        "sneaker-red": "https://example.com/photos/sneaker-red.jpg",
        "sneaker-blue": "https://example.com/photos/sneaker-blue.jpg",
        "mug-white": "https://example.com/photos/mug-white.jpg",
    }
    with ThreadPoolExecutor(max_workers=4) as pool:
        for path in pool.map(process, photos.items()):
            print("saved", path)

Two practical notes. Output URLs are for fetching the result, so download and store the file in your own storage rather than linking to it long term. And keep the worker count modest; four parallel jobs is a sensible start for a batch script.

If you would rather see a result before writing any code, upload a photo in the image studio and compare it with your current tool.

What does an AI photos background remover cost per image?

Pricing for an AI photos background remover API is simplest when it is flat, and here it is: Recraft Remove Background costs 1 credit per output image, rounded up to whole credits. Credits cost $0.01 each on a monthly plan and $0.015 each as a top-up. Top-up credits never expire, which suits seasonal work such as a catalogue refresh twice a year.

PhotosCreditsCost on a monthly plan ($0.01/credit)Cost with top-up credits ($0.015/credit)
11$0.01$0.015
100100$1$1.50
1,0001,000$10$15
10,00010,000$100$150

For scale: the Starter plan at $25 a month gives 2,500 credits, which is 2,500 cutouts if that is all you use it for. Creator ($50), Studio ($100) and Pro ($200) scale the same way. Full details are on the pricing page.

Because one key covers every model, the same credits pay for the jobs around background removal too, such as generating a new backdrop or a transparent graphic. Those cost more than a cutout, so it is worth knowing the numbers:

TaskModelCredits per image
Remove a backgroundRecraft Remove Background1
Edit a photo into a new sceneNano Banana 2 Lite4
Generate an asset with a transparent backgroundGPT Image 1.53 (low), 4 (medium), 22 (high)
Higher-resolution generation and editsGPT Image 2.5 Flare or Sunburst6 (1K), 10 (2K), 16 (4K)

You never have to guess: POST /v1/models/price returns the exact price of a request before you run it, which is handy when a script builds requests dynamically and you want a cost check before committing a large batch.

Pipeline from uploaded photo to API job to transparent PNG to composite on a white background
The full batch pipeline: submit, poll, download the cutout, then composite it yourself.

Removing a background vs replacing it

Most people searching for an AI photos background remover eventually want a new background, not an empty one: white for a marketplace listing, a lifestyle scene for an ad, a brand colour for a thumbnail. There are two ways to get there, and choosing the wrong one is a common source of trouble.

Option 1: cut out, then composite yourself

Run the cutout, then place the transparent PNG on your new background with ordinary image code. This is cheap, fast and deterministic: the product pixels are untouched, so logos, labels and fine print stay exactly as photographed. For ecommerce, where the photo must match the item that ships, this is the right default. Here is a white-background composite with Pillow:

from PIL import Image

cutout = Image.open("cutouts/sneaker-red.png").convert("RGBA")
canvas = Image.new("RGBA", cutout.size, (255, 255, 255, 255))
canvas.alpha_composite(cutout)
canvas.convert("RGB").save("sneaker-red-white.jpg", quality=95)

Keep the transparent PNG as your master and generate the flattened JPEG from it. You can then produce a white version, a grey version and a brand-colour version from one cutout, for 1 credit total.

Option 2: ask a generative model for a new scene

When you want the subject placed in a realistic environment with matching light and shadows, a generative image model does a better job than pasting onto a flat photo. Nano Banana 2 Lite is the cheapest Gemini image model on the platform at 4 credits per image, and it accepts up to 10 reference images, so you can pass your photo and describe the new setting:

curl -X POST https://api.unicornapi.net/v1/jobs \
  -H "Authorization: Bearer $UNICORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2-lite",
    "input": {
      "prompt": "Place this sneaker on a light oak floor in a bright, minimal room, soft morning window light, keep the shoe exactly as it is",
      "ref_images": ["https://example.com/photos/sneaker-red.jpg"],
      "aspect_ratio": "1:1"
    }
  }'

The trade-off: generative models redraw the image, so small details on the subject can shift. Stitching, label text and exact colours may not survive perfectly. Check outputs before publishing anything that has to match a real product.

Option 3: generate assets with transparency from the start

If you are creating new graphics rather than editing photos (icons, stickers, illustrated product mockups), skip the removal step. GPT Image 1.5 supports an optional transparent background through its background input field and costs 3 credits at low quality or 4 at medium. For larger outputs and up to 16 reference images, GPT Image 2.5 Flare is the faster variant and GPT Image 2.5 Sunburst the more polished, slower one, both at 6, 10 or 16 credits for 1K, 2K or 4K. Both accept a background field too; the docs list the values each model supports.

Getting clean edges: common mistakes

Whatever AI photos background remover you use, most bad cutouts trace back to the input or to what happens after. These are the mistakes worth avoiding.

  • Shrinking before removing. Resizing a photo down before removal throws away the edge detail the model needs. Remove on the original, then resize the cutout.
  • Saving the cutout as JPEG. As covered above, JPEG has no alpha channel. Keep a PNG or WebP master.
  • Low contrast between subject and background. A white mug on a white table is hard for any model. When you control the shoot, pick a background that differs in colour and brightness from the subject.
  • Subject cropped at the frame edge. A product that touches the border can get a flat, hard edge where the frame cut it. Leave some space around the subject.
  • Several subjects in one photo. The model has to guess which one is “the subject”. If you want only one item, crop to it first.
  • Glass, smoke and see-through fabric. These are partly transparent in real life, which is the hardest case for matting. Expect to review these by hand.
  • Losing the shadow. Removal deletes the floor shadow along with the floor, which can make products look like they are floating. Add a soft shadow when compositing, or use a generative scene instead.
  • Mismatched light in the composite. A subject lit from the left pasted onto a scene lit from the right looks fake no matter how clean the edge is.
  • Heavily compressed inputs. Screenshots and images saved many times carry blocky artefacts around edges that the model may treat as part of the subject.

A useful quality check for batches: composite every cutout onto a dark grey background as well as white. Leftover halos from the original background are invisible on white and obvious on grey.

What about video, mobile apps and HD quality?

AI video background remover

Video is a different problem. If you run a still-image remover on each frame independently, every frame gets judged on its own, and the edges flicker as the matte shifts slightly from frame to frame. Dedicated AI video background remover tools track the subject across frames to keep the result stable. The removal model covered in this guide is for still images, so it suits photos, thumbnails and product shots rather than footage.

Apps and APKs

Related searches show plenty of people looking for an AI photos background remover app or APK. Phone apps are convenient for a quick edit on the go. Be careful with APK files from outside official app stores: a sideloaded app gets the same photo-library access as any other app, without store review. If your workflow already lives on a computer or a server, an API call is simpler than shuttling files to a phone and back.

HD and 4K photos

“Remove background HD quality” is another common search. Resolution in a cutout mostly comes from the input: the model separates pixels that already exist. Start from the largest original you have, and avoid tools or settings that downscale uploads. If you need a 4K image of a new scene rather than a cutout, that is a generation task, which is where the 4K option on the GPT Image 2.5 models fits.

Running it from your editor or an agent

If you work in Cursor, Claude Code or another coding agent, you can call the same models through MCP without writing the HTTP code yourself. The agents page shows the setup, and the model catalog lists everything one key can reach, from this AI image background remover to video, audio and chat models.

The short version: for a few photos, use whichever free AI photos background remover you like. For anything repeatable, a 1-credit API call, a polling loop and a few lines of Pillow give you consistent, transparent cutouts you control, at a price you can check before every batch.

Frequently asked questions

Is there a free AI photos background remover?

Yes. Many web tools and phone apps remove backgrounds free for a handful of images, often with limits on resolution, daily volume or commercial use. Read the terms before using results in paid work. If you need hundreds of images or want to automate the job, an API is usually simpler: on Unicorn API, Recraft Remove Background costs 1 credit per image, which is $0.01 on a monthly plan or $0.015 with a top-up.

Is the remove background feature considered AI?

In almost every modern tool, yes. One-click background removal runs a neural network trained on large sets of labelled images. The network decides, pixel by pixel, what belongs to the subject and what belongs to the background, then refines the edges into partial transparency. Older approaches such as the magic wand or green-screen keying use fixed colour rules instead, which is why they struggle with hair, fur and busy backgrounds.

Can an AI background remover handle hair and fur?

Good ones can, because they produce a soft alpha matte rather than a hard cut. Strands of hair get partial transparency, so they blend into a new background instead of looking chopped. Results drop when hair is the same colour as the background, when the photo is blurry or heavily compressed, or when the image is very small. Start from the sharpest, largest original you have for the cleanest edges.

Does removing the background reduce image quality?

It should not reduce the subject's detail, but two habits often do. Saving the result as JPEG throws away transparency and adds compression artefacts, so keep cutouts as PNG or WebP. Shrinking the photo before removal also loses edge detail you cannot recover. Run the removal on the original file, keep the transparent master, and create resized or flattened copies from it afterwards.

Can AI remove the background from a video?

Yes, but video needs tools built for it. Running a still-image remover on each frame separately tends to make edges flicker, because every frame is judged on its own. Dedicated video background removers track the subject across frames to keep the matte stable. The background removal model on Unicorn API covered here works on still images, so use it for photos, thumbnails and product shots.

How much does it cost to remove photo backgrounds with an API?

On Unicorn API, Recraft Remove Background costs 1 credit per output image. Monthly plans price credits at $0.01, so 1,000 cutouts cost about $10; top-up credits cost $0.015 each and never expire, so the same batch costs about $15. The Starter plan at $25 a month covers 2,500 cutouts. You can check the exact price of any request before running it.