# Create beautiful product photo

Generating background is fantastic way of improving product photo look. It can be even solution for creating product pack shots without need of manually taking expensive commercial photo shoots. It automatically removes background around the main subject, places it in the center of specified canvas (width and height API parameters) and generates image around the subject.

There are two types of background generation:

1. Blended (original image over the generated background)\
   Pros: the product stays identical to the original, no risk of product distortion, predictable result, product can be positioned freely,\
   Cons: less creative freedom, the product cannot be naturally integrated into the scene (e.g., held in a hand), weaker light/shadow interaction with the environment.
2. Fully generative\
   Pros: the product can be modified by the scene (e.g., covered by something or held in a hand), higher creative freedom and more realistic scene integration.\
   Cons: limited generation resolution (1024×1024), risk that the product may look different from the original.

### Blended background generation

| Parameter              | Description                                                                                                                                                                                                                   |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| description            | Text prompt describing the scene                                                                                                                                                                                              |
| item\_area\_percentage | Parameter between 0 and 1 that controls size of the object which is placed in the middle of final image. So, 0.85 is 85%                                                                                                      |
| sample\_num            | Seed for random generator. Basically is "id" of generated image. When not specified, image will randomly different every time.                                                                                                |
| color                  | When color is specified, generated background is converted to b\&w and then to specified color. It works best for prompts such as: "item standing on plain white background". Color has to be RGB array - f.e. \[255,255,255] |
| generation\_type       | Should be set to "**outpainting**". Other type is "**generate**" which will regenerate whole image with given product. Outpainting guarantees product unchanged.                                                              |

Let's place the bottle of perfumes from below photo in other environment.

<figure><img src="/files/AL06ocJsMKT3XsFoCYXi" alt=""><figcaption></figcaption></figure>

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "background": {
        "generate": {
            "description": "Small {item} positioned on a moss-covered rock, misty forest in the background.",
            "item_area_percentage": 0.75,
            "generation_type": "outpainting"
        }
    }
}
```

<figure><img src="/files/Mll27ARuDQa5aPshjWIm" alt=""><figcaption></figcaption></figure>

We can specify also image resolution:

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 1000,
    "height": 1000,
    "background": {
        "generate": {
            "description": "Small {item} positioned on a moss-covered rock, misty forest in the background.",
            "item_area_percentage": 0.75,
            "generation_type": "outpainting"
        }
    }
}
```

<figure><img src="/files/mDV3qkaX36PqF2BLUYGk" alt=""><figcaption></figcaption></figure>

When specifying a color:

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 1000,
    "height": 1000,
    "background": {
        "generate": {
            "description": "item positioned on plain white background",
            "item_area_percentage": 0.65,
            "color": [217,179,190]
        }
    }
}
```

<figure><img src="/files/YRMBTOFlVh546ekVcD9t" alt=""><figcaption></figcaption></figure>

### Generative background generation

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 1000,
    "height": 1000,
    "background": {
        "generate": {
            "description": "Item positioned on a moss-covered rock, misty forest in the background.",
            "generation_type": "generate"
        }
    }
}
```

<figure><img src="/files/WiFuS32ZpqXqOPpFYlf9" alt=""><figcaption></figcaption></figure>

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 1024,
    "height": 1024,
    "background": {
        "generate": {
            "model_type": "gemini-3-pro-image-preview",
            "description": "Place this item on a moss-covered rock, misty forest in the background."
        }
    }
}
```

<figure><img src="/files/Q4Mz9eo4Z92fuOK9UAFe" alt=""><figcaption></figcaption></figure>

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 2048,
    "height": 2048,
    "background": {
        "generate": {
            "model_type": "see-dream-4.5",
            "description": "Place this item on a moss-covered rock, misty forest in the background."
        }
    }
}
```

<figure><img src="/files/idhXydXPDlTR4UFTkSNj" alt=""><figcaption></figcaption></figure>

```json
{
    "url": "https://deep-image.ai/api-example.png",
    "width": 1024,
    "height": 1024,
    "background": {
        "generate": {
            "model_type": "flux2-klein9b",
            "description": "Place this item on a moss-covered rock, misty forest in the background."
        }
    }
}
```

<figure><img src="/files/9Y9ICvkvA4lMOCKiTd1Y" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.deep-image.ai/common-usecases/create-beautiful-product-photo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
