Agent skill
nano-banana-image
Edit or generate images using Nano Banana Pro (Google's gemini-3-pro-image-preview model). Use when the user asks to edit, translate, recreate, or generate an image using AI. Requires GEMINI_API_KEY environment variable.
Install this agent skill to your Project
npx add-skill https://github.com/akaihola/skills-akaihola/tree/main/nano-banana-image
SKILL.md
Nano Banana Image Editing
Edit existing images or generate new ones using Nano Banana Pro (gemini-3-pro-image-preview).
Model names
| Display name | API model name |
|---|---|
| Nano Banana | models/gemini-2.5-flash-image |
| Nano Banana Pro | models/gemini-3-pro-image-preview |
List all available models:
uvx --from google-genai python3 -c "
import google.genai as genai, os
client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])
for m in client.models.list():
print(m.name, '-', m.display_name)
"
Quick usage
# Edit an existing image
~/.claude/skills/nano-banana-image/scripts/nano_banana_edit.py \
"Your prompt here" \
--input path/to/input.jpg \
--output path/to/output.png
# Generate a new image from scratch
~/.claude/skills/nano-banana-image/scripts/nano_banana_edit.py \
"Your prompt here" \
--output path/to/output.png
SDK — critical rules
Use the new google-genai package (not the deprecated google-generativeai):
# /// script
# dependencies = ["google-genai", "Pillow"]
# ///
import google.genai as genai
from google.genai import types
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
response = client.models.generate_content(
model="models/gemini-3-pro-image-preview",
contents=[
types.Part.from_bytes(data=img_bytes, mime_type="image/jpeg"),
"Your prompt",
],
config=types.GenerateContentConfig(
response_modalities=["IMAGE", "TEXT"],
),
)
# Extract the image from the response
for part in response.candidates[0].content.parts:
if part.inline_data and part.inline_data.mime_type.startswith("image/"):
raw_bytes = part.inline_data.data
break
⚠️ Critical gotcha: API returns JPEG even for PNG outputs
The API returns JPEG-encoded bytes regardless of what output format you want. Always re-save through Pillow to get a correctly formatted PNG:
from PIL import Image
import io
img = Image.open(io.BytesIO(raw_bytes))
img.save(Path("output.png"), format="PNG")
# Pillow detects the actual format (JPEG) and re-encodes as PNG
If you skip this step and just write the raw bytes to a .png file,
the file will contain JPEG data with a PNG extension — GIMP and other
tools will report it as corrupted.
⚠️ Do not use response_mime_type
The old google-generativeai SDK's response_mime_type parameter is not supported
for image models — it only accepts text/plain etc. Use response_modalities instead:
# ❌ Wrong — causes INVALID_ARGUMENT error
config={"response_mime_type": "image/png"}
# ✅ Correct
config=types.GenerateContentConfig(response_modalities=["IMAGE", "TEXT"])
⚠️ Use google-genai, not google-generativeai
# ❌ Deprecated — does not support image generation properly
import google.generativeai as genai
# ✅ Current SDK
import google.genai as genai
from google.genai import types
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
youtube-to-markdown
Convert a YouTube video into clean, readable Markdown using its free auto-generated captions (no paid API needed). Use when the user asks to "convert YouTube video to markdown", "get transcript from YouTube URL", "summarise this video", or wants to turn YouTube subtitles/captions into readable text. Prefer this over youtube-transcription when the video already has auto-generated subtitles — it's free and faster. Accepts YouTube URLs.
brave-search
Search the web using Brave Search API. Use when the user asks to "search the web", "look up current information", "find news about", "research a topic online", "check prices online", or needs up-to-date facts that may not be in the model's training data. Requires BRAVE_SEARCH_API_KEY. Supports structured web results (pages, FAQs, news, videos) and an optional AI summarizer.
verkkokauppa
Search products on the Verkkokauppa.com Finnish webshop. This skill uses the Verkkokauppa search API directly, requiring no browser. Use when the user asks to "search Verkkokauppa", "find products on verkkokauppa.com", "verkkokauppa product search", "check Verkkokauppa prices", or mentions searching the Verkkokauppa store.
clasohlson
Search products on the Clas Ohlson Finland webshop (clasohlson.com/fi/). This skill uses the Voyado Elevate (Apptus eSales) search API directly, requiring no browser. Use when the user asks to "search Clas Ohlson", "find products on clasohlson.com", "clas ohlson product search", "check Clas Ohlson prices", or mentions searching the Finnish Clas Ohlson store.
bauhaus
Search products on the Bauhaus webshop (bauhaus.fi). This skill uses the Algolia search API with automatic key refresh. Use when the user asks to "search Bauhaus", "find products on bauhaus.fi", "bauhaus product search", "check Bauhaus prices", or mentions searching the Bauhaus store.
library
Didn't find tool you were looking for?