Grok Imagine Image 2.0 Preview

Grok Imagine Image 2.0 Preview is xAI's next-generation image generation and editing model for both text-to-image and prompt-guided image transformation. It keeps the same core workflow as the current Grok Imagine image family, including aspect-ratio control and image-based editing, while adding a dedicated quality parameter so teams can tune output fidelity within the same API shape. It is a strong fit for creative production pipelines that want one Grok image endpoint for generation, editing, and quality-sensitive iteration without switching to a separate model family.

Complete technical specification for integration
Step-by-step tutorials for advanced use cases
← All GuidesEditing images with Grok Imagine Image 2.0
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
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.
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, and rendering readable text is the text guide.
The request
An edit is an imageInference call with the source image in inputs.referenceImages and the change described in the prompt.
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'
})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())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"
}
]'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{
"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"
}[
{
"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.referenceImagesis 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.resolutionsets the output tier,1Kor2K, 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 uses explicitwidthandheightinstead. You can pass a fixedwidth/heightpair here too, but not alongsideresolution.settings.qualitycurrently exposes a singlemediumlevel, so there is nothing to tune there yet.
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
Every edit keeps the source and changes one thing. These are the jobs the model handles day to day.
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:
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
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:
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
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:
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
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:
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
-
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.
-
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.
-
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.
-
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".
-
Let
resolutionfollow the source.1Kor2Kadapts to the source's aspect, so you keep the original shape. Reach for a fixedwidth/heightpair only when you deliberately want to change the aspect. -
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.









