Plus plan

Change Background

Create a new background for a picture from your description
POST
/v1/ai/generation/background

About this tool

You describe a background and the AI creates it. You can add a photo of your subject, such as a product, and the AI puts it into the new scene. You can choose to keep the subject exactly as it is. You can also choose the shape, size, picture format and style. The AI can make mistakes, so check the result.
For example, you have a photo of a bottle and want to see it on a marble table.

How to use it

  1. Choose this tool.
  2. Add the picture of your subject with Upload or drag and drop, or skip it to create only a scene.
  3. Describe the new background you want.
  4. Choose whether to keep the subject exactly as it is, and set the shape and how many pictures.
  5. Press Generate, then download the result.

What you get back

You get one or more new pictures with the new background. You can download them.
TEST IT LIVE

Try Change Background 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/background
Tool ID
ai.generation.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/background" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'on_unsupported=error' \
  -F 'instructions=example' \
  -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.background({
    "on_unsupported": "error",
    "instructions": "example",
    "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()->background([
    'on_unsupported' => 'error',
    'instructions' => 'example',
    'n' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Generate a background scene, or a new background around a supplied subject image. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.background).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output.

Change Background works from text and settings, so no file is needed. The required inputs are instructions.

Not on the Free plan: Change Background 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/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.