nano-banana-build
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano Banana Image Generation Skill
Nano Banana图像生成Skill
Use this skill to generate and edit images using the Python SDK with Gemini's specialized image models (Nano Banana).
google-genai使用此Skill,通过 Python SDK结合Gemini的专用图像模型(Nano Banana)来生成和编辑图像。
google-genaiQuick Start Setup
快速开始设置
python
from google import genai
from google.genai import types
from PIL import Image
import io
client = genai.Client()python
from google import genai
from google.genai import types
from PIL import Image
import io
client = genai.Client()Reference Materials
参考资料
- Model Capabilities: Comparison of Gemini 2.5 vs 3 Pro, resolutions, and token costs.
- Image Generation: Text-to-Image, Interleaved Text/Image.
- Image Editing: Subject Customization, Style Transfer, Multi-turn Editing.
- Thinking Process: Understanding thoughts and signatures (Gemini 3 Pro).
- Recipes: Extensive collection of examples (Logos, Stickers, Mockups, Comics, etc.).
- Source Code: Deep inspection of SDK internals.
- 模型能力: Gemini 2.5与3 Pro的对比、分辨率及令牌成本说明。
- 图像生成: 文本生成图像、文本/图像交错生成。
- 图像编辑: 主体定制、风格迁移、多轮编辑。
- 思考过程: 理解Gemini 3 Pro的思考逻辑和签名机制。
- 示例配方: 丰富的示例集合(标志、贴纸、模型图、漫画等)。
- 源代码: 深入解析SDK内部实现。
Available Models
可用模型
- (Nano Banana): Fast, high-quality generation and editing. Best for most use cases.
gemini-2.5-flash-image - (Nano Banana Pro): Highest fidelity, supports
gemini-3-pro-image-previewand2Kresolution, complex prompt adherence, and grounding.4K
- (Nano Banana): 快速、高质量的生成与编辑。适用于大多数使用场景。
gemini-2.5-flash-image - (Nano Banana Pro): 最高保真度,支持
gemini-3-pro-image-preview和2K分辨率,精准贴合复杂提示词,具备图像grounding能力。4K
Common Workflows
常见工作流
1. Fast Generation
1. 快速生成
python
response = client.models.generate_content(
model='gemini-2.5-flash-image',
contents='A cute robot eating a banana',
config=types.GenerateContentConfig(
response_modalities=['IMAGE']
)
)python
response = client.models.generate_content(
model='gemini-2.5-flash-image',
contents='A cute robot eating a banana',
config=types.GenerateContentConfig(
response_modalities=['IMAGE']
)
)2. High-Quality Editing
2. 高质量编辑
python
response = client.models.generate_content(
model='gemini-3-pro-image-preview',
contents=[
types.Part.from_uri(file_uri='gs://.../shoe.jpg', mime_type='image/jpeg'),
"Change the color of the shoe to neon green."
],
config=types.GenerateContentConfig(response_modalities=['IMAGE'])
)python
response = client.models.generate_content(
model='gemini-3-pro-image-preview',
contents=[
types.Part.from_uri(file_uri='gs://.../shoe.jpg', mime_type='image/jpeg'),
"Change the color of the shoe to neon green."
],
config=types.GenerateContentConfig(response_modalities=['IMAGE'])
)