# 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] |

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

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FWjDrxNNF3nZ5B9jJBDY2%2Fapi-example%20(1).png?alt=media&#x26;token=bf008ada-c747-47a0-b3ff-596e1adef307" 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
        }
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FgeietNSBtllFhceuJM44%2Fimage.png?alt=media&#x26;token=200aa372-7c79-470b-b644-36bc20d5cdd5" 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
        }
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FE9RaHxhlt9y91ElJRwNj%2Fimage.png?alt=media&#x26;token=e25f06c1-4247-4bd7-9076-2ae43197671f" 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="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FGAebqoW6V2cn4R6HCHz6%2Fimage-api-doc.png?alt=media&#x26;token=2a8e0355-3312-426b-a43a-b2468d5ad2be" alt=""><figcaption></figcaption></figure>

### Generative background generation

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

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FfIialul5UGKKsm24a2gI%2Fimage.png?alt=media&#x26;token=fbe190b1-5544-4d72-a278-b53483185550" 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="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FWYfwynafiGRl6mDcPTB6%2Fgenerated_image.png?alt=media&#x26;token=94fcfa5f-b7f8-45c8-9d3b-546cfe3f8b38" 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="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FGrNz7PzyqwNelHpQb0nN%2Fc004fa02-b94f-4fa9-a640-76029bd99ac0.png?alt=media&#x26;token=6451532d-b350-4967-82dd-3ec1b78a4237" 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="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2Fk92d0jcqUjruuKKufnKm%2Fimage.png?alt=media&#x26;token=ab1113d8-344d-4e13-abb7-418bb5825db4" alt=""><figcaption></figcaption></figure>
