Edit Image
gemini_edit_imageEdit or transform images using a text instruction. Supports single or multiple input images with control over aspect ratio and output resolution.
Instructions
Edit or transform one or more images using a text instruction, powered by the Google Gemini Nano Banana image model.
Supports single or multiple input images. Provide file paths and/or base64-encoded image data along with a text instruction.
Args:
prompt (string, required): A text instruction describing the edit (e.g. "Remove the background", "Combine these two images").
image_paths (string, optional): Comma-separated list of file paths to input images on disk. Example: "/path/to/img1.png,/path/to/img2.jpg"
image_base64_list (string, optional): JSON array of objects with "data" and "mimeType" fields for base64-encoded images. Example: [{"data":"base64...","mimeType":"image/png"}]
aspect_ratio (string, optional): Aspect ratio for the output image. Supported: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
model (string, optional): Gemini model ID. Defaults to "gemini-3.1-flash-image-preview".
output_path (string, optional): File path to save the edited image.
Returns:
The edited image as an embedded image block (and optionally saved to disk).
Any text the model returns alongside the image.
Examples:
prompt: "Change the car color to red" with one image
prompt: "Combine these two photos into a collage" with two images
prompt: "Apply the style of the first image to the second image" with two images
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Gemini model ID (default: gemini-3.1-flash-image-preview) | gemini-3.1-flash-image-preview |
| prompt | Yes | Text instruction describing the desired image edit | |
| image_size | No | Output image resolution: "1K" (1024px), "2K" (2048px), or "4K" (4096px) | |
| image_paths | No | Comma-separated list of file paths to input images (e.g. '/path/img1.png,/path/img2.jpg') | |
| output_path | No | Optional file path to save the edited image | |
| aspect_ratio | No | Aspect ratio for the output image. Supported: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 | |
| image_base64_list | No | JSON array of objects with "data" and "mimeType" fields for base64-encoded images |