/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
- Python
- Node.js
- cURL
Request parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
images | array of strings | required | Base64-encoded PNG images (max 4 MB each) |
prompt | string | required | Text description of the desired change |
model | string | — | Model to use for editing (e.g. "flux-kontext-max") |
mask | string | — | Base64-encoded PNG mask — white areas are edited, black areas are preserved |
n | integer | 1 | Number of output images to generate (1–10) |
size | string | "1024x1024" | Output resolution: "256x256", "512x512", or "1024x1024" |
response_format | string | "url" | "url" or "b64_json" |
strength | number | — | How strongly the edit is applied (0.0–1.0). Lower = more faithful to the original |
guidance_scale | number | — | How closely the model follows the prompt (0.0–20.0). Higher = more literal |
num_inference_steps | integer | — | Denoising steps (1–100). More steps = sharper result, slower generation |
seed | integer | — | Fixed seed for reproducible outputs |
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
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:
strength | Effect |
|---|---|
0.1–0.3 | Subtle changes — texture, colour, minor detail edits |
0.4–0.6 | Moderate changes — object swaps, lighting adjustments |
0.7–1.0 | Heavy changes — full style transfer, background replacement |
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
url or b64_json per item, plus an optional revised_prompt.
Image requirements
| Requirement | Value |
|---|---|
| Format | PNG |
| Max file size | 4 MB per image |
| Encoding | Base64 string |
| Max images per request | 10 |
| Mask format | PNG, same dimensions as source |
Best practices
Keep source images under 4 MB
Keep source images under 4 MB
Resize large photos before encoding. A 1024×1024 PNG is typically well under 2 MB. Oversized images return a
400 error.Be explicit about what to keep
Be explicit about what to keep
The more specific the prompt, the better the edit respects the original. Mention what should stay unchanged.
Use lower strength for subtle edits
Use lower strength for subtle edits
A
strength of 0.3–0.5 works well for lighting corrections, colour grading, and texture changes without losing structural detail.Increase guidance_scale for literal prompts
Increase guidance_scale for literal prompts
When the model isn’t following the prompt closely enough, increase
guidance_scale (try 7–12). Very high values (>15) can introduce artefacts.