设计与多媒体

Nanobanana Image

试用

Image generation and editing based on Google Gemini native image generation (Nano Banana).

它能做什么

Image generation and editing based on Google Gemini native image generation (Nano Banana). Supports text-to-image generation, image editing with reference images (modify elements/style/color), multi-image composition, Google Search real-time generation, YouTube video frame-to-image generation, and up to 4K resolution output. Use this skill when users need to generate images, edit images, perform style transfer, or composite multiple images.

技能文档

Nano Banana Image Generation/Editing Skill

Based on the Google Gemini native image generation API (Nano Banana), a single script covers all image generation and editing scenarios.

Prerequisites

1. Install dependencies

pip install google-genai Pillow

2. Set API Key

export GEMINI_API_KEY=your_gemini_api_key
# HTTP/HTTPS proxy (optional)
# export HTTPS_PROXY=$HTTPS_PROXY
# export HTTP_PROXY=$HTTP_PROXY

Get your API Key from Google AI Studio or Google Cloud Console.


1. Text-to-Image Generation

Generate new images from text descriptions.

# Basic generation
python3 scripts/generate.py \
  --prompt "A photorealistic portrait of an elderly Japanese ceramicist in his workshop, golden hour lighting, 85mm lens bokeh"

# Specify resolution and aspect ratio
python3 scripts/generate.py \
  --prompt "A minimalist 16:9 wallpaper of a misty mountain lake at dawn" \
  --aspect-ratio 16:9 \
  --image-size 2K \
  --output wallpaper.png

# Use Pro model for professional assets
python3 scripts/generate.py \
  --model gemini-3-pro-image \
  --prompt "A modern minimalist logo for a coffee shop called 'The Daily Grind'. Bold sans-serif font, black and white, circular composition with a coffee bean motif." \
  --output logo.png

# Output image only, no text
python3 scripts/generate.py \
  --prompt "A kawaii sticker of a happy red panda with bamboo hat, white background, bold outlines" \
  --image-only \
  --output sticker.png

2. Image Editing

Provide a reference image and describe the modifications in text.

# Modify image elements
python3 scripts/generate.py \
  --prompt "Add a small knitted wizard hat on the cat's head. Match the soft lighting of the photo." \
  --images cat.jpg \
  --output cat_wizard.png

# Local editing (semantic inpainting)
python3 scripts/generate.py \
  --prompt "Change only the blue sofa to a vintage brown leather chesterfield sofa. Keep everything else unchanged." \
  --images living_room.jpg \
  --output living_room_edited.png

# Style transfer
python3 scripts/generate.py \
  --prompt "Transform this city street photo into Van Gogh's 'Starry Night' style. Preserve the composition but add swirling brushstrokes in deep blues and bright yellows." \
  --images city.jpg \
  --output city_van_gogh.png

# Sketch to rendered image
python3 scripts/generate.py \
  --prompt "Turn this rough pencil sketch into a polished concept car photo in a showroom. Keep the sleek lines, add metallic blue paint and neon rim lighting." \
  --images car_sketch.jpg \
  --output car_rendered.png

3. Multi-Image Composition (up to 14 images)

Provide multiple reference images to compose new scenes or maintain character/product consistency.

# People composition (maintain character features)
python3 scripts/generate.py \
  --prompt "An office group photo of these people making funny faces. Natural lighting." \
  --images person1.jpg person2.jpg person3.jpg person4.jpg \
  --aspect-ratio 5:4 \
  --image-size 2K \
  --output group_photo.png

# Product + model composition (high-fidelity detail retention)
python3 scripts/generate.py \
  --prompt "Create a professional e-commerce fashion photo. The woman wears the blue floral dress from the first image. Full-body shot, outdoor lighting." \
  --images dress.jpg model.jpg \
  --output ecommerce.png

# Logo placement
python3 scripts/generate.py \
  --prompt "Put this logo on the woman's black t-shirt. Logo naturally printed on fabric following folds. Woman's face unchanged." \
  --images woman.jpg logo.png \
  --output woman_with_logo.png

4. Google Search Real-Time Generation

Generate images based on real-time search information (weather charts, news graphics, sports scores, etc.).

# Weather visualization
python3 scripts/generate.py \
  --prompt "Visualize the current weather forecast for the next 5 days in Tokyo as a clean modern weather chart. Add clothing suggestions for each day." \
  --search \
  --aspect-ratio 16:9 \
  --output weather_tokyo.png

# News graphics (better results with Pro model)
python3 scripts/generate.py \
  --model gemini-3-pro-image \
  --prompt "Make a stylish graphic of last night's Champions League match result." \
  --search \
  --output match_result.png

# Image Search (gemini-3.1-flash-image only)
python3 scripts/generate.py \
  --prompt "A detailed painting of a resplendent quetzal bird in its natural habitat. Create a 3:2 wallpaper with a natural gradient background." \
  --image-search \
  --aspect-ratio 3:2 \
  --output quetzal.png

5. Video Frame to Image (gemini-3.1-flash-image only)

Extract visual themes from YouTube videos to generate new images (posters, thumbnails, infographics, etc.).

# Generate video poster
python3 scripts/generate.py \
  --prompt "Generate a cinematic movie poster that captures the key themes of this video. Bold title typography." \
  --video "https://www.youtube.com/watch?v=UTdfxFyOQTI" \
  --aspect-ratio 9:16 \
  --output poster.png

6. High Thinking Level Generation (Complex Scenes)

# Enable high-quality thinking and save intermediate thought images
python3 scripts/generate.py \
  --prompt "A futuristic city built inside a giant glass bottle floating in space, photorealistic, intricate details." \
  --thinking high \
  --show-thoughts \
  --image-size 2K \
  --output city_bottle.png

Parameter Reference

ParameterDescriptionDefault
--promptText prompt (required)-
--modelModel IDgemini-3.1-flash-image
--outputOutput file pathoutput.png
--image-onlyReturn image only (no text description)Off
--aspect-ratioAspect ratio (e.g. 16:9 9:16 1:1)1:1
--image-sizeResolution (512/1K/2K/4K)1K
--imagesReference image file list (space-separated, up to 14)None
--videoYouTube video URLNone
--searchEnable Google Web SearchOff
--image-searchEnable Google Image Search (3.1 Flash only)Off
--thinkingThinking level minimal/highminimal
--show-thoughtsSave intermediate thought imagesOff

Model Selection Guide

ScenarioRecommended Model
Everyday image generation and editinggemini-3.1-flash-image (default)
Professional logos, commercial ads, complex layoutsgemini-3-pro-image
High-concurrency batch generation, lower quality requirementsgemini-2.5-flash-image
Requires Image Search / video inputgemini-3.1-flash-image (exclusive)

For more parameter details, see references/models-and-params.md.


Notes

  • All generated images contain invisible SynthID watermarks
  • Transparent backgrounds are not supported; post-process if needed
  • --image-size requires uppercase K (1K is correct, 1k will cause an error)
  • Multiple image outputs are automatically saved as output_1.png, output_2.png, etc.
  • Comply with the Google Generative AI Use Policy

相关技能

Recommend suitable prompts from 26,000+ Nano Banana Pro image generation prompts based on user needs. Optimized for Nano Banana Pro (Gemini), but prompts als...

Generate images through the Nano Banana REST API and help agents integrate or operate the service safely. Use when a task involves text-to-image, image-to-im...

18 次安装

AI multi-image generation powered by CellCog via Nano Banana. 10-20 coherent images in one prompt, character consistency across scenes, production-grade composition. Nano Banana AI, Nano Banana Pro, Gemini image generation.

37 次安装

Use when the user wants to generate or edit images with Google's Nanobanana/Gemini image models using the official Gemini API shape, or when they need public...

33 次安装