# 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="/files/Q8KroevNqMhZg2WKYgNs" 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="/files/JdPb1QBWuXVwUs9ba5xJ" 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](/image-processing/advanced-model-types-for-image-generation.md) |
| 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 %}


---

# 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/image-processing/prompt-based-image-editing.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.
