Plus plan

Remove Background (AI)

Cut out the main subject and make the background see-through
POST
/v1/ai/generation/remove-background

About this tool

An AI model (a computer program trained on many pictures) finds the main subject, such as a person or a product, and removes everything behind it. The subject itself is cut from your own picture, so it stays unchanged. You can get the cut-out on a see-through background, a black and white mask (a shape showing what is kept), or fill the background with a colour.
For example, you have a photo of yourself in front of a messy room and you want just you, on a see-through background, for a profile picture.

How to use it

  1. Choose this tool.
  2. Add one picture with Upload, or drag and drop it.
  3. Choose whether you want the cut-out or the mask, and optionally pick a background colour.
  4. Adjust the soft edge or shrink the edge if the outline looks rough.
  5. Press Generate, then download the result.

What you get back

You get a new picture of the subject without its background, saved as PNG if you want to keep the see-through area. You can download it.
TEST IT LIVE

Try Remove Background (AI) in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/generation/remove-background
Tool ID
ai.generation.remove-background
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/generation/remove-background" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'output=cutout' \
  -F 'tolerance=1'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.generation.removeBackground({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "output": "cutout",
    "tolerance": 1
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->generation()->removeBackground([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'output' => 'cutout',
    'tolerance' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Cut the subject out of a picture with an AI model. The model decides what the subject is; its answer becomes a mask that is applied to YOUR original pixels, so the subject comes out unchanged on a transparent background (or as a mask, or on a colour). Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.remove-background).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output, key-colour choice (furthest from the subject), mask from the model answer, subject fidelity check against the input, mask applied to the original pixels, full-resolution output.

Remove Background (AI) works from text and settings, so no file is needed. Every input is optional.

Not on the Free plan: Remove Background (AI) is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/generation/remove-background with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.