---
title: Editing images with Grok Imagine Image 2.0 — Grok Imagine Image 2.0 Preview | Runware Docs
url: https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing
description: "How to edit an image with Grok Imagine Image 2.0: recolour, restyle, remove objects, swap backgrounds, and relight from one reference image and a prompt."
---
### [Introduction](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#introduction)

Editing is where Grok Imagine Image 2.0 earns the "images for real work" label. You hand it one image and a prompt, and it changes **only what you asked for** while holding the rest of the frame steady. It ranks second on the public image-edit leaderboard, and the reason is precision: a recolour stays on the product, a removed object leaves no trace, and everything you didn't mention comes back untouched.

![A white leather low-top sneaker on a plain light-grey studio background](https://runware.ai/docs/assets/source-sneaker.Dxh5yWbP_Zh4wKC.jpg)

*One prompt recolours the shoe and leaves the rest of the shot alone*

> **Prompt**: Recolor the sneaker into a bold teal-and-orange colourway: a deep teal upper with bright orange accents on the laces, the tongue tag, and the heel counter, keeping the crisp white rubber sole. Keep the exact shoe shape, panels, and stitching, the plain light-grey studio background, the soft lighting, and the centred framing completely unchanged.

This guide covers the edit request, how the prompt drives the change, and the everyday jobs: restyling, removing elements, swapping backgrounds, and relighting. Generating an image from scratch is the [prompting guide](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/prompting), and rendering readable text is the [text guide](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/text-rendering).

### [The request](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#the-request)

An edit is an `imageInference` call with the source image in `inputs.referenceImages` and the change described in the prompt.

TypeScriptPythoncURLCLIJSON

```typescript
import { createClient } from '@runware/sdk'

const client = await createClient({ apiKey: process.env.RUNWARE_API_KEY })
await client.connect()

const [result] = await client.run({
  model: 'xai:grok-imagine@image-2.0',
  positivePrompt: 'Recolor the sneaker into a bold teal-and-orange colourway, keeping the exact shoe shape, the plain studio background, the lighting, and the framing unchanged.',
  inputs: {
    referenceImages: [
      'https://example.com/sneaker.jpg'
    ]
  },
  resolution: '2K'
})
```

```python
import asyncio
import os

from runware import Runware

async def main():
    async with Runware(api_key=os.environ["RUNWARE_API_KEY"]) as client:
        results = await client.run({
            "model": "xai:grok-imagine@image-2.0",
            "positivePrompt": "Recolor the sneaker into a bold teal-and-orange colourway, keeping the exact shoe shape, the plain studio background, the lighting, and the framing unchanged.",
            "inputs": {
                "referenceImages": [
                    "https://example.com/sneaker.jpg"
                ]
            },
            "resolution": "2K"
        })

asyncio.run(main())
```

```bash
curl https://api.runware.ai/v1 \
  -H "Authorization: Bearer $RUNWARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "taskType": "imageInference",
      "taskUUID": "c2a3b4d5-e6f7-4890-b123-456789abcdef",
      "model": "xai:grok-imagine@image-2.0",
      "positivePrompt": "Recolor the sneaker into a bold teal-and-orange colourway, keeping the exact shoe shape, the plain studio background, the lighting, and the framing unchanged.",
      "inputs": {
        "referenceImages": [
          "https://example.com/sneaker.jpg"
        ]
      },
      "resolution": "2K"
    }
  ]'
```

```bash
runware run xai:grok-imagine@image-2.0 \
  positivePrompt="Recolor the sneaker into a bold teal-and-orange colourway, keeping the exact shoe shape, the plain studio background, the lighting, and the framing unchanged." \
  inputs.referenceImages.0=https://example.com/sneaker.jpg \
  resolution=2K
```

```json
{
  "taskType": "imageInference",
  "taskUUID": "c2a3b4d5-e6f7-4890-b123-456789abcdef",
  "model": "xai:grok-imagine@image-2.0",
  "positivePrompt": "Recolor the sneaker into a bold teal-and-orange colourway, keeping the exact shoe shape, the plain studio background, the lighting, and the framing unchanged.",
  "inputs": {
    "referenceImages": [
      "https://example.com/sneaker.jpg"
    ]
  },
  "resolution": "2K"
}
```

Response

```json
[
  {
    "taskType": "imageInference",
    "taskUUID": "c2a3b4d5-e6f7-4890-b123-456789abcdef",
    "imageUUID": "8d2c3e4f-5a6b-7890-cdef-012345678901",
    "imageURL": "https://im.runware.ai/image/os/a14d18/ws/2/ii/8d2c3e4f-5a6b-7890-cdef-012345678901.jpg"
  }
]
```

Three things shape an edit request:

- `inputs.referenceImages` is the **single source image** to edit, a URL, a data URI, or a UUID. It takes **one image**, so editing works on one picture at a time.
- `resolution` sets the output tier, `1K` or `2K`, and **adapts to the source's aspect ratio** rather than forcing a fixed shape. It is available only when editing, which is why the [prompting guide](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/prompting) uses explicit `width` and `height` instead. You can pass a fixed `width`/`height` pair here too, but not alongside `resolution`.
- `settings.quality` currently exposes a single `medium` level, so there is nothing to tune there yet.

### [How the prompt drives an edit](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#how-the-prompt-drives-an-edit)

An edit prompt is not a scene description. It is an **instruction about the change**, and two habits make it land:

- **Describe the change, not the whole image.** "Recolour the sneaker to teal" edits in place. Re-describing the entire shot invites the model to regenerate it and lose the source.
- **Name what stays.** "Keep the shoe shape, the background, and the framing unchanged" fences the edit. Without it the model tends to touch more than you asked, and precision is the whole point of editing rather than regenerating.

### [Editing operations](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#editing-operations)

Every edit keeps the source and changes one thing. These are the jobs the model handles day to day.

#### [Restyling the whole look](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#restyling-the-whole-look)

A restyle changes **every pixel's treatment** while holding the composition and content. It is the fast way to turn a photograph into a different medium, a plate into a painting or an illustration, without redrawing it. The coastline below, repainted in oil:

![A photograph of a rugged coastal cliff with turquoise sea and golden sandstone rocks at midday](https://runware.ai/docs/assets/source-coast.BAvv8_Qo_Z23dI4G.jpg)

> **Prompt**: Restyle the whole photograph as a loose hand-painted oil painting: visible brushstrokes and palette-knife texture across the rocks and water, slightly heightened warm sandstone and turquoise tones, a soft painterly sky. Keep the exact composition, the cliff, the sea, and the horizon in place. Impressionist coastal landscape in oil.

The cliff, the sea, and the horizon stay exactly where they were, and only the medium changed. Name a concrete style, "hand-painted oil", "flat vector illustration", "1990s film stock", rather than "make it artistic", and keep the prompt on the look while the source carries the composition.

#### [Removing an element](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#removing-an-element)

Point at one thing and take it out, and the model **fills the gap** with what belongs behind it. It is the everyday cleanup edit: a stray sign, a passer-by, wires across a view. Here the power lines leave a country road:

![A countryside road curving through green hills with wooden utility poles and power lines along the roadside](https://runware.ai/docs/assets/source-road.CoslmcZl_ZcR7HS.jpg)

> **Prompt**: Remove the wooden utility poles and the power lines completely and fill the space with the continuing hills, sky, and roadside grass so nothing looks edited. Keep the road, the hills, the distant farmhouse, the daylight, and the composition exactly as they are.

The poles and lines are gone and the hills run continuous where they stood. **Replacing** works the same way: instead of "remove", describe what takes its place, "replace the road sign with a wooden fence post", and the model swaps it in rather than clearing it.

#### [Swapping the background](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#swapping-the-background)

Background replacement keeps the subject and **rewrites everything behind them**, the way a studio composite would but without a cut-out. The headshot below moves from a studio backdrop into an office:

![A corporate headshot of a woman in a navy blazer on a plain light-grey studio background](https://runware.ai/docs/assets/source-headshot.e_iSMCVv_1wcryk.jpg)

> **Prompt**: Replace the plain grey studio background behind the woman with a bright modern open-plan office, softly defocused desks and warm wood accents, gentle daylight from large windows. Keep the woman, her pose, her navy blazer, her expression, and the soft light on her face exactly as they are, and blend her edges naturally into the new setting.

Her face, pose, and wardrobe carry through untouched while the room behind her changes, and the softly defocused office keeps her from looking pasted on. It is the fast path for a headshot that has to work across several settings, or one photo reused across a site and its socials.

#### [Relighting the scene](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#relighting-the-scene)

Relighting changes the **light and time of day** while the geometry stays put, which turns one shoot into several looks. This listing shot moves from flat midday to golden dusk:

![A modern two-storey house photographed under flat bright midday daylight](https://runware.ai/docs/assets/source-house.BSKDnJCj_bN425.jpg)

> **Prompt**: Relight the scene from flat midday daylight to a warm golden dusk just after sunset: a deep blue sky with warm low light raking across the render and timber, the interior lights glowing warmly through the windows, soft long shadows across the garden. Keep the house, the garden, the driveway, and the composition exactly unchanged, changing only the light and the time of day.

The house and garden are pixel-for-pixel the same shot, relit. Describe the light end to end, "from flat midday to warm golden dusk with the interior lights on", and the model has both the starting point and the target rather than a vague "make it warmer".

### [Tips](https://runware.ai/docs/models/xai-grok-imagine-image-2-0/guides/editing#tips)

1. **Describe the change, not the scene.** An edit prompt is an instruction. "Recolour the jacket to forest green" edits in place; re-describing the whole photo regenerates it.
    
2. **Name what stays.** "Keep the pose, the background, and the lighting unchanged" fences the edit and stops the model from drifting into parts you meant to leave alone.
    
3. **Give a style a concrete name.** "Hand-painted oil" or "flat vector illustration" restyles more reliably than "make it artistic". Let the source carry the composition.
    
4. **Describe light end to end when relighting.** "From flat midday to warm golden dusk" gives the model the target, not just a direction like "warmer".
    
5. **Let `resolution` follow the source.** `1K` or `2K` adapts to the source's aspect, so you keep the original shape. Reach for a fixed `width`/`height` pair only when you deliberately want to change the aspect.
    
6. **Feed a clean source.** Edits inherit the source's quality, so a sharp, well-lit original recolours, removes, and relights more cleanly than a soft or noisy one.