edit_image
Modify only a selected image region using a box or PNG mask while keeping all pixels outside it identical; use it for targeted retouching or local redraws without changing the rest.
Instructions
Edit only one region of an image; every pixel outside it stays identical to the original.
Pass exactly one region:
box: [x0, y0, x1, y1] in the image's pixels (x1, y1 exclusive).
mask_path: a PNG the same size as the image; white (or opaque white) pixels may change. Codex redraws the picture from the original and the mask (~30-60 s, plan usage limits); the result is aligned back onto the original and only the region's pixels are taken. background: flat colour a transparent original is shown on; inside the region that colour is keyed back to transparency (tolerance = RGB distance). The result reports alignment (scale, origin, error) and a warning when the match is poor; the full generated image stays at raw_path.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"image_path": "<image_path>",
"prompt": "<prompt>",
"output_path": "<output_path>"
},
"name": "edit_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| box | No | ||
| prompt | Yes | ||
| mask_path | No | ||
| overwrite | No | ||
| tolerance | No | ||
| background | No | #FF00FF | |
| image_path | Yes | ||
| output_path | Yes | ||
| timeout_seconds | No | ||
| reasoning_effort | No | low |