Skip to content

Edit image

POST
/v1/images/edits
curl --request POST \
--url https://api.mirapi.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form image=@cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png \
--form mask=@file \
--form 'prompt=A cute baby sea otter wearing a beret.' \
--form n=1 \
--form size=1024x1024 \
--form response_format=url \
--form user= \
--form model=dall-e-2

Creates an edited or extended image given an original image and a prompt.

Media typemultipart/form-data
object
image
required

The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.

string format: binary
mask

An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.

string format: binary
prompt
required

A text description of the desired image(s). The maximum length is 1000 characters.

string
n

The number of images to generate. Must be between 1 and 10.

string
size

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

string
response_format

The format in which the generated images are returned. Must be one of url or b64_json.

string
user

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

string
model
string
Example
{
"image": "cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png",
"mask": [],
"prompt": "A cute baby sea otter wearing a beret.",
"n": "1",
"size": "1024x1024",
"response_format": "url",
"user": "",
"model": "dall-e-2"
}
Media typeapplication/json
object
Examplegenerated
{}