Endpoint
Request
Headers
string
required
Must be
multipart/form-datastring
required
The AI provider to use (e.g.,
openai)string
required
Your API key for the specified provider
Form Parameters
file
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.
string
required
A text description of the desired edits. Maximum length is 1000 characters.
file
An additional image whose fully transparent areas indicate where the original image should be edited. Must be a PNG file, less than 4MB, and have the same dimensions as the original image.
string
The model to use for image editing. Currently only
dall-e-2 is supported.integer
default:1
Number of edited images to generate (1-10)
string
default:"1024x1024"
Size of the generated images:
256x256, 512x512, or 1024x1024string
default:"url"
Format of the response:
url or b64_jsonstring
Unique identifier for the end-user
Response
integer
Unix timestamp of when the edited image was created
array
Examples
Basic Image Edit
Response
Python SDK
JavaScript SDK
Using a Mask
Python with Mask
Download Edited Image
Base64 Response
Generate Multiple Variations
Creating Masks
Masks are PNG images where:- Transparent pixels (alpha = 0) indicate areas to edit
- Opaque pixels (alpha = 255) indicate areas to keep unchanged
Creating a Mask in Python (PIL)
Image Requirements
- Format: Must be PNG with RGBA support
- Size: Less than 4MB
- Dimensions: Must be square (same width and height)
- Supported Sizes: 256x256, 512x512, or 1024x1024
- Transparency: If no mask is provided, the image must have transparent areas
Tips for Better Edits
- Clear Prompts: Be specific about what you want to change
- Use Masks: For precise control over edit regions
- Quality Images: Start with high-quality, clear images
- Appropriate Size: Use larger sizes (1024x1024) for better detail
- Generate Multiple: Use
n > 1to get variations
Common Use Cases
- Object Replacement: Replace objects in images
- Background Changes: Change backgrounds while keeping subjects
- Style Transfer: Apply different styles to image regions
- Inpainting: Fill in missing or unwanted parts of images
- Enhancement: Add details or elements to existing images