brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
nano-bananaGenerate or edit images using Google Nano Banana (Gemini image generation API). Trigger this skill whenever the user asks to generate an image, draw something, create artwork, edit a photo, or mentions "nano banana", "nanobanana", or any AI image generation/editing need — even if they don't explicitly mention Nano Banana. Proactively use this skill for any …
Independent GitHub snapshot · Automated classification · Original documentation governs
Generate or edit images locally using the Google Gemini image generation API (a.k.a. Nano Banana).
/var/minis/attachments/source /etc/profile && echo $GEMINI_API_KEY | head -c 10
⚠️ Always run
source /etc/profilefirst — environment variables are stored there and won't be available otherwise.
If not set, direct the user to Google AI Studio to obtain a key, then:
echo 'export GEMINI_API_KEY="your_key_here"' >> /etc/profile
pip show google-genai pillow 2>&1 | grep -E "^Name|not found"
If missing:
pip install google-genai pillow
| Model | Model ID | Best For |
|---|---|---|
| Nano Banana 2 (recommended) | gemini-3.1-flash-image-preview | Fast, high quality, 2K support — default choice |
| Nano Banana Pro | gemini-3-pro-image-preview | Complex prompts, professional assets, precise text rendering |
| Nano Banana (original) | gemini-2.5-flash-image | Ultra-low latency, simple tasks |
Default to gemini-3.1-flash-image-preview unless the user explicitly requests another version.
❌ Wrong (old API, throws AttributeError):
# types.ImageGenerationConfig does not exist!
image_generation_config=types.ImageGenerationConfig(aspect_ratio="16:9")
✅ Correct:
config=types.GenerateContentConfig(
response_modalities=["IMAGE"],
image_config=types.ImageConfig(
aspect_ratio="16:9", # options: 1:1, 4:3, 3:4, 16:9, 9:16
image_size="2K", # options: 1K, 2K (default: 1K)
),
)
❌ Running python3 script.py directly may not have the API key
✅ Always prefix with source /etc/profile && python3 script.py
part.as_image() returns a PIL Image object — call .save(path) directly. No need to handle base64 manually.
Run any script with:
source /etc/profile && python3 <skill-path>/nano-banana/scripts/<script>.py [args]
gen.py — Text to ImageUsage: gen.py "prompt" [output_path] [aspect_ratio] [resolution]
Example: gen.py "a panda drinking tea in a bamboo forest" /var/minis/attachments/out.png 1:1 2K
edit.py — Image Editing (image + prompt → image)Usage: edit.py <input_image> "edit instruction" [output_path]
Example: edit.py /var/minis/attachments/photo.jpg "add a wizard hat to the cat" /var/minis/attachments/edited.png
batch.py — Batch Generation (multiple prompts → multiple images)Edit the TASKS list at the top of the script, then run it.
When the user makes an image generation request:
source /etc/profile && echo $GEMINI_API_KEY | head -c 10ls <skill-path>/nano-banana/scripts/file_write to recreate them from the source in this skillsource /etc/profile && python3 <skill-path>/nano-banana/scripts/gen.py "prompt" /var/minis/attachments/out.png 16:9 2Ksource /etc/profile && python3 <skill-path>/nano-banana/scripts/edit.py <image_path> "instruction" /var/minis/attachments/out.pngTASKS in scripts/batch.py, then run it16:9 for banners/social media, 1:1 for avatars/covers, 9:16 for phone wallpapers, 3:4 for portrait cards| Issue | Cause & Fix |
|---|---|
AttributeError: ImageGenerationConfig | Deprecated API — use image_config=types.ImageConfig(...) instead |
KeyError: GEMINI_API_KEY | Run source /etc/profile before executing the script |
| Only text returned, no image | Ensure response_modalities includes "IMAGE" |
| Poor image quality | Switch to gemini-3-pro-image-preview or refine the prompt |
| Rate limit error | Free tier has limits — wait a moment and retry |
| Save fails | Confirm /var/minis/attachments/ directory exists |