Plus plan

AI object eraser

Remove a person or object from a photo and fill the gap naturally
POST
/v1/ai/generation/erase

About this tool

This tool takes an unwanted thing out of your picture, such as a stranger or a bin, and fills the empty space so it looks as if it was never there. You say what to erase in a few words. You can also remove its shadow and choose to fill the gap with the surroundings or a plain colour. It uses AI (a computer program that creates images), so results can vary and you may want to try again.
For example, you have a holiday photo with a stranger walking behind your family, and you want a clean picture of just the family.

How to use it

  1. Choose this tool.
  2. Add one picture with Upload, or drag and drop it.
  3. In What to erase, describe the thing to remove, for example the red car on the left.
  4. Choose what to fill the gap with, and turn on Remove its shadow too if needed.
  5. Press Generate, then download your new picture.

What you get back

You get a new picture with the object removed, ready to download. If you asked for several versions, you can compare them and keep the best one.
TEST IT LIVE

Try AI object eraser 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/erase
Tool ID
ai.generation.erase
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/erase" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'fill=natural' \
  -F 'n=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.erase({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "fill": "natural",
    "n": 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()->erase([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'fill' => 'natural',
    'n' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Remove an object (and its shadow) and fill the gap so it looks as if it was never there. An optional region keeps all pixels outside it byte-identical. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.erase).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output, region-locked compositing (pixels outside the region are restored from the original).

AI object eraser works from text and settings, so no file is needed. Every input is optional.

Not on the Free plan: AI object eraser 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/erase 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.