edit_image
Modify an existing image using a prompt and exact file path, with optional reference images for style transfer or added elements. Apply edits like object changes, style adjustments, or retouching.
Instructions
Edit a SPECIFIC existing image file, optionally using additional reference images. Use this when you have the exact file path of an image to modify.
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": {
"imagePath": "<imagePath>",
"prompt": "<prompt>"
},
"name": "edit_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model to use. "gemini-nano-banana-2.1" (default, Nano Banana 2.1 — pro quality at Flash speed), "gemini-3.1-flash-image" (Nano Banana 2, previous default), "gemini-3.1-flash-lite-image" (Nano Banana 2 Lite — fastest and cheapest, 1K output only), "gemini-2.5-flash-image" (legacy fast), or "gemini-3-pro-image" (Nano Banana Pro, highest quality) | |
| preset | No | Shape by use: "web" (16:9 landscape), "phone" (9:16 portrait), "webconf" (16:9 video-call background for Zoom/Teams), "banner" (4:1 wide strip, e.g. LinkedIn banner), "square" (1:1). Overridden by aspectRatio when both are given. Size is set with imageSize. | |
| prompt | Yes | Text describing the modifications to make to the existing image | |
| imagePath | Yes | Full file path to the main image file to edit | |
| imageSize | No | Resolution of the output image. Default: "1K". Use "2K" or "4K" for high-resolution output. "512px" works only on "gemini-3.1-flash-image". | |
| aspectRatio | No | Aspect ratio of the output image. Omit to let the model choose: new images usually come out landscape (about 16:9) and edits keep the source image's shape. Pass "1:1" for a square image. | |
| thinkingLevel | No | How much the model reasons before drawing. "minimal" is fastest and cheapest; "high" is best for complex prompts (infographics, text in images, several consistent characters). Default: the model's own ("medium" on "gemini-nano-banana-2.1"). "gemini-3.1-flash-image" and "gemini-3.1-flash-lite-image" accept only "minimal" or "high"; "gemini-2.5-flash-image" does not support thinking levels. | |
| referenceImages | No | Optional array of file paths to additional reference images to use during editing (e.g., for style transfer, adding elements, etc.) | |
| useGoogleSearch | No | Enable Google Search grounding for fact-aware image generation. Not supported on "gemini-3.1-flash-lite-image". |