Generate Image
gemini_generate_imageGenerate an image from a text prompt using Google Gemini. Supports multiple aspect ratios and model options.
Instructions
Generate an image from a text prompt using the Google Gemini Nano Banana image generation model.
Args:
prompt (string, required): A detailed description of the image to generate.
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 to use. Defaults to "gemini-3.1-flash-image-preview".
output_path (string, optional): File path to save the generated image.
Returns:
The generated image as an embedded image block (and optionally saved to disk).
Any text the model returns alongside the image.
Examples:
"A photorealistic golden retriever surfing a wave at sunset"
"An isometric pixel-art castle on a floating island"
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 | A detailed text description of the image to generate | |
| image_size | No | Output image resolution: "1K" (1024px), "2K" (2048px), or "4K" (4096px) | |
| output_path | No | Optional file path to save the generated 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 |