Grok Imagine: Edit a Photo Without Changing the Face
The edit pattern
- Edit, do not regenerate. If the subject and layout are already right and only one to three details need to change, edit the image. Generating a new one changes the subject.
- Lead with the change. The first sentence is what should be different.
- Add one keep sentence. Name what stays: the same face, hair, pose, angle, crop and background.
- Stop there. Pasting in a full new description of the scene restages it, and the subject drifts.
Copy-paste edit prompts
Change clothes
Replace the [current clothing] with [new clothing: material and color]. Keep the same face, hair, expression, pose, framing and background.
Change the background
Change the background to [place and light, for example a sunlit cafe window]. Keep the same person, face, pose, clothing and crop.
Change the lighting
Make the light warm late-afternoon sun from the left with soft shadows. Keep the same face, pose, clothing, background and framing.
Add one object
Add a [object] on the table in front of the person. Keep the same face, pose, clothing, background and framing; change nothing else.
Restyle without losing the face
Render this as a [pencil sketch / oil painting / anime illustration]. Keep the same face, pose, hairstyle and composition so the person is clearly recognizable.
Fix a small detail
Remove the [object] from the left edge of the frame. Keep everything else, including the face, pose, lighting and crop, exactly as it is.
Make it professional
Turn this casual photo into a clean headshot: neutral light-gray background, soft even lighting, and a dark blazer. Keep the same face, hair, expression and head angle.
When an edit does not land
- Change the words, not the volume. Repeating “more realistic” tends to add a new texture in the wrong place. Point at the part: “the jacket shows visible wool weave at the collar”.
- Edit in small steps. Chain edits, using each output as the next input, and change one thing at a time.
- Name each object as what it is. “Satchel” and “backpack” are different things to the model.
- Judge against your original request. If the face drifted after several rounds, go back to the last good image and make a smaller edit.
- Describe materials, not prohibitions. A long avoid list is easy to ignore; say what you want to see instead.
The same edit through the API
curl -X POST https://api.x.ai/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $XAI_API_KEY" \
-d '{
"model": "grok-imagine-image-2.0",
"prompt": "Replace the grey jacket with a dark green wool coat. Keep the same face, hair, pose, framing and background.",
"image": {"url": "https://example.com/my-photo.jpg", "type": "image_url"},
"aspect_ratio": "3:2",
"quality": "medium"
}'The source image can be a public URL, a base64 data URI or a file ID from xAI’s Files API. See xAI’s image editing docs.
More image prompts
Working from your own photos? See Grok prompts for uploaded images, or browse best Grok image prompts.
FAQ
How do I edit an image in Grok Imagine without changing the face?
Edit the existing picture instead of generating a new one. Open the prompt with the one to three things that should change, then add one sentence naming what must stay the same (the face, the angle, the crop). Do not paste a full new description of the scene.
Why does the face change when I edit?
Most often because the prompt restages the whole scene. xAI’s prompting guide says an edit that pastes in a full new prompt restages the picture, so the subject drifts. A short, targeted edit keeps the subject put.
Does “keep everything the same” work?
According to xAI’s guide, an edit that opens with “keep everything” barely moves. State the change first, then use one keep sentence that names the specifics.
Can I do this through the API?
Yes. xAI’s image editing endpoint is /v1/images/edits with a JSON body and the model grok-imagine-image-2.0. The OpenAI SDK’s images.edit() is not supported because it sends multipart form data; use the xAI SDK, the Vercel AI SDK or a direct HTTP request.
Is it okay to edit anyone’s photo?
Edit photos of yourself, or of people who have agreed. Do not use edits to impersonate someone, mislead people, or create content that targets a real person.