Grok Imagine Image Edit API

xai/grok-imagine-image/edit
5 aspect ratios · 1 reference image

Grok Imagine Image Edit transforms a reference image through written changes to subjects, backgrounds, and visual style. The source supplies the visual starting point, while the prompt identifies what to change and which details to carry into the result.

Get API Key
Input
615/5000
1/1
Reference image 1: Reference 1

Examples

Corduroy at the Roller Rink

Change only the adult roller skater's blue zip-up sports jacket into a warm orange corduroy jacket with clear fine vertical ribs and believable seams. Preserve the same person's face, curly dark hair, exact pose, body proportions, black knee pads, roller skates, railing, rink, daylight and framing. Keep the jacket shape practical and natural. This is a selective clothing material and color edit, not a new scene. No other changes, lettering, logos or promotional elements.

Harbor in Three-Color Woodcut

Reinterpret the supplied cargo harbor photograph as a carefully carved three-color woodcut print using only indigo, brick red and warm ivory. Preserve the exact number and placement of the main gantry cranes, the stacks of containers, the quay edge and the perspective. Replace photographic shading with carved directional hatching and confident ink shapes; retain clear mechanical silhouettes and spatial depth. Slight handmade registration texture, no new objects, labels, typography, borders or advertising.

Grok Imagine Image Edit

Grok Imagine Image Edit is xAI’s model for transforming an existing image through natural-language instructions. It uses one reference image alongside a description of the desired changes, giving background, subject, and style revisions a shared visual starting point. This approach suits product scene variations, portrait restyling, and illustration revisions, with five output aspect ratios to match the composition to its intended placement.

Why Choose Grok Imagine Image Edit?

  • Edits anchored in a referenceThe source image establishes the subject and setting, so a revision starts from an existing visual rather than a new scene description.

  • Changes expressed in everyday languageDescribe a background replacement, a different color, or a new visual style in the same instruction that identifies the details to retain.

  • Explore several directions from one sourceReuse the original reference with different editing instructions to compare studio settings, color treatments, or illustrated versions.

  • A frame suited to the revisionChoose an output aspect ratio for the edited composition, whether the result is intended as a portrait, square post, or landscape visual.

Parameters

ParameterRequirementDescription
promptRequired

Describe the requested changes and source details to retain. Enter 1–5,000 characters.

image_urlsRequired

Provide exactly one publicly accessible HTTP(S) image URL. Use JPEG, PNG, or WebP, up to 10 MB.

sizeOptional

Choose 1:1, 2:3, 3:2, 16:9, or 9:16.

1:12:33:216:99:16

How to Use

  1. Upload the source and describe the editUpload one image and enter the changes and details to retain in Prompt.

  2. Choose the revised image’s frameSelect Size for the edited image’s intended placement.

  3. Run and view the resultReview the price and select Run, then preview and download the completed result.

Pricing

One credit equals $0.005.

UsageRateDetails
Image editing6 credits / image$0.030 / image

Use Cases

  • Product setting variationsUse a product image as the reference and describe a new surface, background, or lighting treatment to develop alternative product scenes.

  • Portrait restylingStart from a portrait and describe a photographic or illustrated treatment, naming the facial and clothing details that should remain.

  • Illustration revisionsProvide an existing illustration and describe changes to its palette, objects, or surroundings for another creative direction.

Prompt Tips

  • Separate the instruction into the change you want and the source details you want to retain.
  • Name an object by its appearance and location, such as “the blue cup on the left,” when a reference contains several subjects.
  • For a background edit, describe the new setting and its lighting together.
  • Reuse the original reference when comparing independent revisions; use a generated result as the next reference when continuing an edit.

Usage Notes

  • Save the task_id to retrieve the result, or provide callback_url for a completion notification.

Related Models

Grok Imagine Image Edit API frequently asked questions

What is the Grok Imagine Image Edit API?

Grok Imagine Image Edit is an xAI model for editing an existing image with text instructions. It changes subjects, backgrounds, and visual style from a single reference image, with five output aspect ratios. The image supplies the visual starting point, while the instruction identifies both the requested revision and details to retain. You can call it through the API or try it in the Playground tab.

How do I specify a targeted change in Grok Imagine Image Edit?

Describe the change and name the source details to retain in the same prompt. For example: “Replace the wall with a blue studio background; keep the ceramic cup, its handle, and its position.” The reference supplies the original visual context.

Can Grok Imagine Image Edit change a product background?

Yes. Provide the product image and describe the new surroundings, surface, and lighting. Identify the product itself as the subject to retain so the editing instruction distinguishes it from the setting.

Can Grok Imagine Image Edit restyle an illustration?

Yes. Use the illustration as the reference and name the new medium, palette, or visual treatment. Include the characters, objects, or composition details that should carry into the revised image.

Which reference formats does Grok Imagine Image Edit accept?

Provide one JPEG, PNG, or WebP image up to 10 MB. In an API request, image_urls contains exactly one publicly accessible HTTP(S) URL; in the Playground, upload that image before running the edit.

Which output ratios can I select in Grok Imagine Image Edit?

Use size to choose 1:1, 2:3, 3:2, 16:9, or 9:16. The selected value sets the output aspect ratio; describe the subject’s desired position as part of the editing instruction.

When should I choose Grok Imagine Image Edit instead of Grok Imagine Image Text to Image?

Choose Grok Imagine Image Edit when you have a source image and a specific revision in mind. Grok Imagine Image Text to Image starts from a written brief and is suited to creating a new visual concept.