Skip to main content
Creates an edited or extended image given an original image and a prompt. The image must be provided as a file upload.

Request Body

This endpoint accepts multipart/form-data.
file
required
The image to edit. Must be a valid PNG file, less than 4MB, and square.
string
required
A text description of the desired edit.
string
required
The model to use for image editing.
file
An additional image whose fully transparent areas indicate where the image should be edited. Must be a valid PNG file with the same dimensions as the original image.
integer
default:"1"
The number of images to generate. Must be between 1 and 10.
string
default:"1024x1024"
The size of the generated images.
string
default:"url"
The format of the generated images. Either url or b64_json.

Response

integer
Unix timestamp of when the images were created.
array
Array of edited images.

Examples

Edit with Mask

Edit Without Mask

Response Example

Notes

The mask image must have transparency where you want edits to occur. Fully opaque areas will remain unchanged.
For best results, ensure your original image and mask are both square PNG files with the same dimensions.