edit_image
Repaint only a masked region of an existing local image while preserving all outside pixels; supply a mask image or region coordinates.
Instructions
EDIT an existing local image: repaint only the masked area (inpainting) while the rest stays pixel-identical -- the tool re-composes the result on the CPU, so outside-mask pixels cannot drift. Give either mask_image or regions. Models are chosen by priority (qwen-image-edit > flux2-klein > qwen-image); the loaded model wins when it can region-edit. Returns absolute PNG paths for the agent to inspect.
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": {
"init_image": "<init_image>",
"prompt": "<prompt>"
},
"name": "edit_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | -1 for random. | |
| model | No | Model to use. Omit to let the tool pick by priority (qwen-image-edit > flux2-klein > qwen-image). | |
| steps | No | Sampling steps. Defaults to the engine's own. | |
| prompt | Yes | The change to make, described in English. Say WHAT should appear in the masked area, not what to 'edit'. | |
| verify | No | agent = the calling agent must inspect the returned image. | |
| channel | No | Engine endpoint. auto tries /sdcpp/v1/img_gen first, then /sdapi/v1/img2img. | |
| dry_run | No | Build the mask and payload, call nothing. Use it to check coordinates cheaply. | |
| regions | No | Areas to repaint, drawn on the CPU into a greyscale PNG mask. White = repaint, black = keep. Use this when you have no mask file. Example: {"unit":"norm","regions":[{"type":"rect","x":[0.1,0.4,0.6,0.9]}]}. | |
| sampler | No | Sampler name, e.g. euler. | |
| strength | No | Denoising strength 0..1 (default 0.75). Low keeps the original look, high follows the prompt harder. | |
| cfg_scale | No | CFG / guidance scale. | |
| mask_blur | No | Mask feather in pixels (engine side). | |
| timeout_s | No | Job timeout in seconds (default 900). | |
| init_image | Yes | Absolute path of the image to modify (PNG or JPEG). | |
| mask_image | No | Absolute path of a mask PNG (white = repaint). Rescaled to the image size when needed. Use the bundled annotator to draw one. | |
| output_dir | No | Absolute output directory. | |
| filename_prefix | No | Filename prefix. | |
| inpaint_padding | No | Extra context pixels around the mask. | |
| negative_prompt | No | What to avoid inside the mask. |