edit_image
Edit existing images using text prompts. Supports inpainting with optional mask and preserves unchanged pixels for sequential refinements.
Instructions
Edit an existing image using OpenAI gpt-image-2's /images/edits endpoint.
This is the right tool for:
Image-to-image refinement (OpenAI's answer to reference images)
Inpainting with a mask (paint over regions while preserving the rest)
Sequential/cumulative edits that preserve unchanged pixels
Brand-accurate modifications to existing images
Key features of gpt-image-2 editing:
input_fidelity='high'(default) keeps unchanged pixels constant — critical for multi-step refinement where each edit should build on the last without drift.Full control over quality, background, output_format, and compression.
Supports optional PNG mask (transparent pixels are the edit region).
Typical workflow:
Generate or obtain a base image (path on disk)
Call edit_image with prompt='change the sky to sunset'
Take the output path, call edit_image again with next instruction
Repeat — each step preserves pixels outside the described change
Args: params: Edit parameters including prompt, image_path, and options.
Returns: Formatted response with edited image path and metadata.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |