nano-banana

Generate and edit images using the Google Gemini image generation API.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/riipandi/minis-skills --skill nano-banana-riipandi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nano-banana
Source: https://github.com/riipandi/minis-skills/tree/main/nano-banana
Command: npx skills add https://github.com/riipandi/minis-skills --skill nano-banana-riipandi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires google-genai, pillow, and includes scripts (resource) components.

What problem does it solve? Creating or editing images requires design tools and manual effort; this Skill lets you generate images from text prompts or edit existing photos directly through the Google Gemini (Nano Banana) image generation API from the command line. ## Core Features & Use Cases - Text-to-Image Generation: Create images from natural language prompts with configurable aspect ratios (1:1, 16:9, 9:16, etc.) and resolutions (1K, 2K) via gen.py. - Image Editing: Modify an existing image with an instruction (e.g., "add a wizard hat to the cat") using edit.py. - Batch Generation: Produce multiple images in one run by editing the TASKS list in batch.py. - Use Case: You need a 16:9 banner for a blog post — run one script with your prompt and get a 2K image saved to /var/minis/attachments/, ready to display inline. ## Quick Start Ask the assistant to generate an image of your chosen subject with your preferred aspect ratio, and it will run the bundled script and display the result inline.

Frequently Asked Questions about nano-banana

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an image from a text prompt with the Gemini API?

Run the bundled gen.py script with your prompt, output path, aspect ratio, and resolution, for example: python3 gen.py "a panda drinking tea" out.png 1:1 2K. It calls the Gemini image generation model and saves the result as a PNG.

How do I edit an existing image with AI using a text instruction?

Use the edit.py script with the input image path and an edit instruction, such as python3 edit.py photo.jpg "add a wizard hat to the cat" edited.png. The script sends the image bytes plus your prompt to the Gemini model and saves the edited image.

Which Gemini image model should I use for image generation?

The default is gemini-3.1-flash-image-preview (Nano Banana 2), which balances speed, quality, and 2K support. Use gemini-3-pro-image-preview for complex prompts or precise text rendering, and gemini-2.5-flash-image for low-latency simple tasks.

Why do I get a KeyError for GEMINI_API_KEY when running the script?

The API key is stored in /etc/profile, which is not loaded by default in every shell. Prefix your command with source /etc/profile && so the GEMINI_API_KEY environment variable is available to the Python script.

Why does ImageGenerationConfig throw an AttributeError?

types.ImageGenerationConfig is a deprecated API that no longer exists in the current google-genai SDK. Use types.GenerateContentConfig with image_config=types.ImageConfig(aspect_ratio=..., image_size=...) instead.

What aspect ratios and resolutions does Gemini image generation support?

Supported aspect ratios are 1:1, 4:3, 3:4, 16:9, and 9:16. Resolutions are 1K and 2K, with 1K as the default; pass both as arguments to gen.py or set them in the batch.py task list.