AgentSkillsCN

nano-banana

通过命令行使用Gemini AI API生成图像

SKILL.md
--- frontmatter
name: nano-banana
description: Generate images using the Gemini AI API from the command line

nano-banana

Generate images using the Gemini AI API from the command line.

Command

bash
nano_banana "<prompt>" [options]

Arguments

ArgumentAliasDescription
prompt(positional)The prompt describing the image to generate (required)
--images-iInput image paths to include with the prompt (can be repeated)
--out-oOutput file path (for single image)
--out-dirOutput directory (for multiple images)
--n-nNumber of images to generate (default: 1)
--modelGemini model to use (default: gemini-3-pro-image-preview)
--aspect-ratio-aAspect ratio for generated images
--image-size-sResolution of generated images
--api-keyGemini API key (defaults to GEMINI_API_KEY env var)
--overwriteOverwrite existing files without prompting
--print-textPrint any text response from the model
--jsonOutput results as JSON

Aspect Ratios

Valid aspect ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

Image Sizes

Valid image sizes: 1K, 2K, 4K

Higher resolutions provide more detail but take longer to generate.

Examples

Basic usage

bash
nano_banana "A cute cat playing piano" -o cat.png

Generate multiple images

bash
nano_banana "A sunset over mountains" --out-dir ./images -n 3

Specify aspect ratio for portrait

bash
nano_banana "A professional headshot" -o portrait.png --aspect-ratio 3:4

Landscape image at high resolution

bash
nano_banana "A panoramic mountain vista" -o vista.png --aspect-ratio 21:9 --image-size 4K

Square social media image

bash
nano_banana "Abstract art pattern" -o social.png -a 1:1 -s 2K

Get JSON output

bash
nano_banana "test prompt" --out result.png --json

Edit an existing image

bash
nano_banana "Make this photo black and white" -i photo.jpg -o bw-photo.png

Combine multiple images

bash
nano_banana "Create a collage from these images" -i img1.png -i img2.png -i img3.png -o collage.png

Style transfer from reference image

bash
nano_banana "Apply the style of this painting to my photo" -i painting.jpg -i photo.jpg -o styled.png

Environment

Set GEMINI_API_KEY environment variable to avoid passing --api-key each time:

bash
export GEMINI_API_KEY="your-api-key"

Output Formats

Supports PNG (.png) and JPEG (.jpg, .jpeg) output formats, determined by the file extension.