Skip to main content
The image editing endpoint lets you modify existing images by providing a text prompt describing the desired changes. You can optionally include a mask to constrain edits to specific regions.

Basic Image Editing

Provide an image and a prompt describing how to modify it.

Inpainting with Masks

Use a mask to specify which region of the image should be edited. The mask is a same-size image where transparent areas indicate where edits should be applied.
The mask must be a PNG with an alpha channel. Transparent pixels mark the area to edit; opaque pixels are preserved.

Supported Formats

Images must be square and no larger than 4MB. Non-square images may be automatically cropped or rejected depending on the model.

Size Constraints

The size parameter controls the output dimensions of the edited image.
For best results, provide an input image that matches the requested output size. Mismatched sizes may result in distortion or quality loss.

Editing with Multiple Outputs

Generate several variations of an edit by setting n.

Saving Edited Images

Best Practices

Without a mask, the model decides what to change. For predictable results, provide a mask that clearly marks the target region.
Describe only what should change, not the entire image. “A blue vase with flowers” works better than re-describing the whole scene.
Provide images at the same resolution you request in size to avoid quality degradation from rescaling.