gpt-image-2-edit
Edit an existing image with GPT Image 2 using a text prompt. Accepts a multipart/form-data body.
Supports up to 16 input images per request (image[]). Input formats: PNG, JPEG. Images must be provided as multipart/form-data file uploads.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Model ID.
gpt-image-2 "gpt-image-2"
Text description of the edit you want to apply.
"Change the background to a sunset over the ocean"
Single source image file to edit (PNG or JPEG). Use image[] instead when providing multiple images.
Multiple source image files (PNG or JPEG). Up to 16 images per request. Use instead of image for multi-image input.
Mask image file with an alpha channel. Indicates which areas of the source image to edit. Must be the same format and same size as the source image (< 50MB). Requires selecting the Direct group.
Output image format. Default: png.
png, jpeg Compression level for jpeg output (0–100).
0 <= x <= 100Number of images to return. Supports 1–10. Default: 1. Requires selecting the Direct group in the console.
1 <= x <= 101
Output image size in {width}x{height} format. Same flexible-resolution constraints as image generation.
"1024x1024"
Response
Image edited successfully.
Array of edited images.