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.

Let's check what we can do.

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.

{
    "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
        }
    }
}

We can specify also image resolution:

{
    "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
        }
    }
}

When specifying a color:

{
    "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]
        }
    }
}

Last updated