# Prompt-based image editing

Prompt-based editing lets you modify a specific part of an image by describing the change you want to see. The API uses a context image and generates a new version based on your instruction.

#### Basic example

Let's us try to remove a blue car from below photo.

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FlGhuB5sfOwYZhn1Cutbl%2Fimage.png?alt=media&#x26;token=558ef758-00db-4a05-ac50-a1a3f6e1a534" alt=""><figcaption></figcaption></figure>

```json
{
  "background": {
    "generate": {
      "description": "remove a blue car",
      "model_type": "gemini-3-pro-image-preview",
      "adapter_type": "img2img",
      "context_images": [
        "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/gitbook1.jpg"
      ]
    }
  },
  "width": 1344,
  "height": 768
}
```

And the result is

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FDru9PjLdZg6jzW1ix6s1%2Fgenerated_image%20(8).png?alt=media&#x26;token=b3adefb7-b3c8-4f60-9565-26d4eed61a75" alt=""><figcaption></figcaption></figure>

#### Parameters of background generate section

| Parameter       | Description                                                                                                                                                                 |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| description     | Text prompt describing the edit you want to apply.                                                                                                                          |
| model\_type     | Model used for editing. Example: gemini-3-pro-image-preview. [Other models](https://documentation.deep-image.ai/image-processing/advanced-model-types-for-image-generation) |
| adapter\_type   | Adapter that defines the editing mode. Use img2img for editing based on an existing image.                                                                                  |
| context\_images | Array of URLs to source images used as context for the edit.                                                                                                                |
| width           | Target width of the output image.                                                                                                                                           |
| height          | Target height of the output image.                                                                                                                                          |

#### Notes

* Use clear and specific prompts (e.g., “remove a blue car”, “replace sky with sunset”).
* The output size is controlled by width and height.
* context\_images must be publicly accessible URLs.

#### Example prompt variations

{% tabs %}
{% tab title="Remove object" %}

```json
{
  "background": {
    "generate": {
      "description": "remove a blue car",
      "model_type": "gemini-3-pro-image-preview",
      "adapter_type": "img2img",
      "context_images": [
        "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/gitbook1.jpg"
      ]
    }
  },
  "width": 1344,
  "height": 768
}
```

{% endtab %}

{% tab title="Change background" %}

```json
{
  "background": {
    "generate": {
      "description": "replace background with a snowy mountain landscape",
      "model_type": "gemini-3-pro-image-preview",
      "adapter_type": "img2img",
      "context_images": [
        "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/gitbook1.jpg"
      ]
    }
  },
  "width": 1344,
  "height": 768
}
```

{% endtab %}

{% tab title="Add detail" %}

```json
{
  "background": {
    "generate": {
      "description": "add a red umbrella on the left side",
      "model_type": "gemini-3-pro-image-preview",
      "adapter_type": "img2img",
      "context_images": [
        "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/gitbook1.jpg"
      ]
    }
  },
  "width": 1344,
  "height": 768
}
```

{% endtab %}
{% endtabs %}
