Skip to main content
The /v1/images/edits endpoint takes one or more existing images and a text description of what to change, then returns modified versions. You can target specific regions using a mask (inpainting), or apply changes to the whole image.

Basic example


Request parameters


Inpainting with a mask

A mask lets you edit only a specific region of the image and leave the rest untouched. The mask is a PNG of the same dimensions as the input:
  • White pixels → the area you want the model to edit
  • Black pixels → the area to preserve exactly
Create masks in any image editor by painting white over the area to change and black over the area to keep, then export as PNG. The mask must be the same width and height as the source image.

Editing multiple images

Pass more than one image to let the model combine or reference several source images in the edit.

Controlling the edit with strength

strength controls how much the model is allowed to deviate from the original image:

Reproducible results with seed

Pass a fixed integer seed to get the same output each time you send the same prompt and image. Useful for A/B testing or generating variants from a known baseline.
Not all models honour the seed parameter. Results may still vary slightly due to floating-point non-determinism in some backends.

Response object

Same shape as the generations endpoint — url or b64_json per item, plus an optional revised_prompt.

Image requirements


Best practices

Resize large photos before encoding. A 1024×1024 PNG is typically well under 2 MB. Oversized images return a 400 error.
The more specific the prompt, the better the edit respects the original. Mention what should stay unchanged.
A strength of 0.3–0.5 works well for lighting corrections, colour grading, and texture changes without losing structural detail.
When the model isn’t following the prompt closely enough, increase guidance_scale (try 7–12). Very high values (>15) can introduce artefacts.