Edit image
edit_imageEdit, restyle, or combine up to 16 reference images using a text prompt. Regenerates the entire picture, with optional mask to preserve areas, and saves results to disk.
Instructions
Edit, restyle, or combine 1-16 reference images with a text prompt using OpenAI GPT Image 2.5. The whole picture is regenerated; without a mask the prompt decides what changes. Saves files to disk and returns paths and token usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of variations to generate; each costs output tokens. Files get -1, -2 suffixes. Default 1. | |
| mask | No | Path of a PNG with alpha, same size as first image. Transparent pixels = region to repaint (guidance, not a hard lock). Default none. | |
| size | No | auto | 1024x1024 | 1536x1024 | 1024x1536 | WIDTHxHEIGHT (multiples of 16, ratio 1:3..3:1, max edge 3840). Overrides aspect_ratio. Default auto. | |
| model | No | flare = fast, general purpose. sunburst = slower, higher precision. Same price. Default flare. | |
| images | Yes | Paths of 1-16 reference images (png/jpeg/webp). First = main subject; others = elements to combine. Relative to server cwd. | |
| prompt | Yes | Image description, or the change to make when editing. | |
| quality | No | Higher = more detail, more output tokens. auto lets the model choose (may be costly). Default auto. | |
| file_name | No | Base name without extension. Default timestamp + prompt slug. | |
| long_edge | No | Longer side in px, used with aspect_ratio. Default 1536. | |
| background | No | transparent needs png or webp. Default auto. | |
| output_dir | No | Save directory. Default IMAGEN_OUTPUT_DIR env or ./output (relative to server cwd). | |
| aspect_ratio | No | Computes size together with long_edge. Default none. | |
| return_image | No | Also return the image inline (base64, ~1.4 MB per 1024x1024 png) so it can be viewed. File is saved either way. Default false. | |
| output_format | No | Also the file extension. Default png. | |
| input_fidelity | No | high keeps faces, text, logos and unmasked areas faithful; costs more input tokens. Default low. | |
| output_compression | No | jpeg/webp quality like JPEG: lower = smaller file, more artifacts. Default 100. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes | ||
| files | Yes | ||
| model | Yes | ||
| usage | No |