generate_image
Turn text descriptions into images by selecting a model, aspect ratio, and number of images. Save results as high-resolution PNGs or preview inline.
Instructions
Generate image(s) from a text prompt.
Args:
prompt: The text description of the image to generate.
model: Friendly alias — nano-banana (default), nano-banana-pro, imagen-4,
imagen-4-fast, imagen-4-ultra. Call list_models for details.
aspect_ratio: e.g. "1:1", "16:9", "9:16". Allowed values depend on the model.
n: Number of images (Gemini loops one per call; imagen-4-ultra supports 1 only).
output_dir: Where to save the full-res PNG(s). Defaults to env
GEMINI_IMAGE_OUTPUT_DIR, else the server's CWD.
return_image: When True, append a downscaled preview of the first image.
Returns:
A list of text lines (one per saved absolute path), optionally followed by a
downscaled preview Image of the first result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | ||
| model | No | nano-banana | |
| prompt | Yes | ||
| output_dir | No | ||
| aspect_ratio | No | 1:1 | |
| return_image | No |