nano-banana

Run inline Python scripts with uv to generate Gemini images.

137|20|Updated Jun 13, 2025
One-click install
npx skills add https://github.com/NikiforovAll/claude-code-rules --skill nano-banana-nikiforovall
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nano-banana
Source: https://github.com/NikiforovAll/claude-code-rules/tree/main/plugins/handbook-nano-banana/skills/nano-banana
Command: npx skills add https://github.com/NikiforovAll/claude-code-rules --skill nano-banana-nikiforovall

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables rapid Python-based scripting to drive Gemini image generation, enabling quick iterations and automated asset production without heavy project setup.

Core Features & Use Cases

  • Inline Python scripting: Write and execute small scripts directly with uv run.
  • Image generation flow: Generate and save assets using Gemini models.
  • Directives & dependencies: Use runtime directives to manage packages and SDKs.

Quick Start

Run a simple image generation script with uv run -: uv run - << 'EOF'

/// script

dependencies = ["google-genai", "pillow"]

///

from google import genai from google.genai import types

client = genai.Client() response = client.models.generate_content( model="gemini-2.5-flash-image", contents=["A cute banana character with sunglasses"], config=types.GenerateContentConfig( response_modalities=['IMAGE'] ) ) for part in response.parts: if part.inline_data is not None: image = part.as_image() image.save("tmp/generated.png") print("Saved: tmp/generated.png") EOF

Frequently Asked Questions about nano-banana

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

FAQPage Schema
How do I generate images with Python and Gemini without setting up a full project?

Python scripting with Gemini enables rapid image generation using uv run with inline dependencies. Write a script declaring google-genai and pillow in a heredoc, call the Gemini API with image generation parameters like aspect_ratio and response_modalities, and save outputs directly to tmp/ without project scaffolding.

Can I run Python scripts with inline dependencies using uv?

Yes, uv run accepts scripts via heredocs with embedded dependency declarations using PEP 723 script metadata. Dependencies like google-genai and pillow are fetched and installed at runtime, allowing stateless execution of one-off Python tasks without a virtual environment or package file.

What's the best way to automate Gemini image generation workflows?

Automate image generation by chaining Python scripts that call Gemini's generate_content API with configurable parameters—aspect_ratio, image_size, response_modalities—and save results to tmp/. Stateless execution enables iterative generate-refine-save cycles without state management overhead.

Does Gemini support configurable image generation options like aspect ratio?

Gemini image generation supports configuration through GenerateContentConfig, including response_modalities set to IMAGE and parameters like aspect_ratio and image_size. These options control output format and dimensions during the API call.

Can I use Python scripting for lightweight tasks without dependency management overhead?

Python scripting with uv eliminates dependency management by declaring packages inline within scripts. Runtime directives fetch and execute dependencies on demand, ideal for lightweight one-off tasks, iterative workflows, and rapid prototyping without persistent environments.

Where are generated images saved when using this workflow?

Generated images are saved to tmp/ with status reporting providing output paths. The workflow extracts inline_data from Gemini responses, converts to PIL Image objects, and persists them locally for retrieval or downstream processing.