generate_image_gemini
Batch-generate Google Gemini images from text prompts and save them to an absolute directory for use in websites or apps.
Instructions
Generate one or more images with Google Gemini (Nano Banana) via the Interactions API and save them to disk.
Use this when the user (or your plan) needs Gemini-generated assets for a website or app. Pass the Gemini image model id (e.g. gemini-3.1-flash-image, gemini-3-pro-image, gemini-2.5-flash-image), a list of prompt + filename pairs, the required absolute_output_directory, and optional response_format settings: aspect_ratio, image_size, mime_type.
Notes:
aspect_ratio: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:8, 8:1, 1:4, 4:1.
image_size: 512, 1K, 2K, or 4K (uppercase K required).
mime_type: currently only image/jpeg is supported.
Images are written only to absolute_output_directory. It must be an absolute path; relative paths are rejected. Each file is named: {filename}-gemini-{model}-{timestamp}.{ext}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Gemini image model id, e.g. gemini-3.1-flash-image, gemini-3-pro-image, gemini-2.5-flash-image, nano-banana-pro-preview. | |
| images | Yes | List of images to generate (prompt + filename) | |
| mime_type | No | Output MIME type. Currently only "image/jpeg" is supported. | |
| image_size | No | Image resolution. One of "512", "1K", "2K", "4K" (uppercase K required). | |
| aspect_ratio | No | Aspect ratio of the generated image. One of 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:8, 8:1, 1:4, 4:1. | |
| absolute_output_directory | Yes | Required absolute directory path where generated images will be saved. Relative paths are rejected. |