Mask gpt-image-1
- Use
maskto specify transparent regions; only the corresponding areas inimageare edited - Requires reference image
image, mask imagemask, and textprompt - Request body is
multipart/form-data(includes binary image fields) - Official docs: Images createEdit
Authorizations
Request Body
The image to edit. Must be a supported image file or array of images. For gpt-image-1, each image should be a png, webp, or jpg file under 25MB. For dall-e-2, you can only provide one image, and it must be a square png file under 4MB.
"binary"A text description of the desired image. Maximum length is 1000 characters for dall-e-2 and 32000 characters for gpt-image-1.
An additional image whose fully transparent areas (e.g. alpha of zero) indicate where image should be edited. If multiple images are provided, the mask is applied to the first image. Must be a valid PNG file under 4MB and the same dimensions as image.
"binary"The model used to generate the image. Only gpt-image-1, gpt-image-1-all, flux-kontext-pro, flux-kontext-max.
The number of images to generate. Must be between 1 and 10.
The quality of the generated image. Only gpt-image-1 supports high, medium, and low quality. dall-e-2 only supports standard quality. Defaults to auto.
The format in which generated images are returned. Must be one of url or b64_json. URLs are valid for 60 minutes after image generation. This parameter only applies to dall-e-2, because gpt-image-1 always returns base64-encoded images; do not use this parameter for gpt-image-1.
The size of the generated image. For GPT image models, must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default). For dall-e-2, must be one of 256x256, 512x512, or 1024x1024. For dall-e-3, must be one of 1024x1024, 1792x1024, or 1024x1792.
Allows setting background transparency for generated images. Only supported in gpt-image-1. Must be one of transparent, opaque, or auto (default). When auto is used, the model automatically determines the best background for the image.
Controls the content moderation level for images generated by gpt-image-1. Can be set to low for less restrictive filtering, or auto (default).