能力概述
AI图像生成能力让你能够:
- 文生图:根据文字描述生成图像
- 图生图:基于参考图像生成新图像
- 图像编辑:修改现有图像的特定部分
- 风格转换:改变图像风格(写实、动漫、油画等)
- 文字渲染:在图像中生成清晰可读的文字
底层基于 Google Gemini 的 Nano Banana / Nano Banana Pro 模型。
工作流程
Phase 1: 需求理解
- 理解用户的图像需求(主题、风格、用途)
- 确认输出格式(尺寸、分辨率、数量)
- 如有参考图,确认编辑意图
Phase 2: Prompt 构建
- 将用户意图转化为英文 Prompt(效果更好)
- 遵循 Prompt 公式:
<subject> <action> <scene> <style> <quality>
- 补充必要的细节描述
Phase 3: 图像生成
- 调用
generate_image 工具
- 如需编辑,调用
edit_image 工具
- 生成多个候选(如用户需要选择)
Phase 4: 交付
- 展示生成结果
- 询问是否需要调整
- 保存到用户指定位置
工具使用
generate_image
- 用途:根据文字描述生成图像
- 参数:
prompt: 图像描述(英文效果更佳)
style: 风格预设(realistic, anime, oil_painting, watercolor, minimal, cinematic)
aspect_ratio: 宽高比(1:1, 16:9, 9:16, 4:3, 3:4)
resolution: 分辨率(1K, 2K, 4K)
num_images: 生成数量(1-4)
- 示例:
generate_image(
prompt="A majestic horse galloping through cherry blossoms, golden hour lighting, Chinese New Year festive atmosphere",
style="realistic",
aspect_ratio="16:9",
resolution="2K",
num_images=2
)
edit_image
Prompt 最佳实践
基础公式
[主体] + [动作/姿态] + [场景/背景] + [风格] + [氛围/光线]
风格关键词
- 写实:photorealistic, hyperrealistic, 8K, detailed
- 动漫:anime style, Ghibli style, cel shading
- 油画:oil painting style, impressionist, Van Gogh style
- 极简:minimal, flat design, vector art
- 电影感:cinematic, dramatic lighting, movie poster style
质量增强词
high quality, detailed, sharp focus
professional photography, award winning
4K resolution, ultra detailed
避免事项
- ❌ 避免模糊描述:"一张好看的图"
- ❌ 避免矛盾描述:"写实风格的卡通"
- ❌ 避免敏感内容
- ✅ 具体、清晰、有层次
应用场景模板
场景1:微信红包封面/节日祝福图
prompt_template: |
A {animal} in {pose}, surrounded by {decorations},
Chinese New Year theme, festive red and gold colors,
{style} style, high quality, {text_content}
variables:
animal: "majestic horse" # 马年
pose: "running gracefully"
decorations: "cherry blossoms, red lanterns, gold coins"
style: "elegant illustration"
text_content: "with Chinese text '恭喜发财' in golden calligraphy"
场景2:演示文稿配图
prompt_template: |
{concept} visualization, professional infographic style,
clean white background, modern corporate aesthetic,
subtle gradients, minimalist design
variables:
concept: "AI workflow automation"
场景3:社交媒体内容
prompt_template: |
{subject} {action}, {platform} optimized aspect ratio,
vibrant colors, eye-catching composition,
trending aesthetic, shareable content style
variables:
subject: "coffee cup"
action: "with steam rising"
platform: "Instagram" # 1:1 or 4:5
输出格式
生成结果展示
## 🎨 图像生成完成
**Prompt**: [使用的英文Prompt]
**参数**:
- 风格: [style]
- 尺寸: [aspect_ratio]
- 分辨率: [resolution]
**生成结果**:

**下一步**:
- [ ] 满意,保存到指定位置
- [ ] 需要调整风格/颜色
- [ ] 需要修改特定部分
- [ ] 重新生成
注意事项
- 版权合规:生成的图像带有 SynthID 水印
- 内容政策:遵守 Google 使用政策,不生成敏感内容
- 商业使用:支持商业用途(营销、产品)
- 文字渲染:Nano Banana Pro 支持多语言文字,但中文效果需要验证
- 角色一致性:跨图保持角色特征需要使用参考图功能
资源引用
resources/prompt_templates.yaml - 预设 Prompt 模板
resources/style_presets.md - 风格预设详解
resources/chinese_new_year_2026.md - 马年专属模板
1---2name: image-generation-23description: AI图像生成与编辑能力,基于 Nano Banana (Gemini Image) 实现文生图、图生图、图像编辑。适用于创意设计、营销素材、社交媒体内容、演示文稿配图等场景。支持多种风格、高分辨率输出(最高4K)、文字渲染、角色一致性保持。4---5
6## 能力概述
7
8AI图像生成能力让你能够:
9- **文生图**:根据文字描述生成图像
10- **图生图**:基于参考图像生成新图像
11- **图像编辑**:修改现有图像的特定部分
12- **风格转换**:改变图像风格(写实、动漫、油画等)
13- **文字渲染**:在图像中生成清晰可读的文字
14
15底层基于 Google Gemini 的 Nano Banana / Nano Banana Pro 模型。
16
17## 工作流程
18
19### Phase 1: 需求理解
201. 理解用户的图像需求(主题、风格、用途)
212. 确认输出格式(尺寸、分辨率、数量)
223. 如有参考图,确认编辑意图
23
24### Phase 2: Prompt 构建
251. 将用户意图转化为英文 Prompt(效果更好)
262. 遵循 Prompt 公式:`<subject> <action> <scene> <style> <quality>`
273. 补充必要的细节描述
28
29### Phase 3: 图像生成
301. 调用 `generate_image` 工具
312. 如需编辑,调用 `edit_image` 工具
323. 生成多个候选(如用户需要选择)
33
34### Phase 4: 交付
351. 展示生成结果
362. 询问是否需要调整
373. 保存到用户指定位置
38
39## 工具使用
40
41### generate_image
42- **用途**:根据文字描述生成图像
43- **参数**:
44 - `prompt`: 图像描述(英文效果更佳)
45 - `style`: 风格预设(realistic, anime, oil_painting, watercolor, minimal, cinematic)
46 - `aspect_ratio`: 宽高比(1:1, 16:9, 9:16, 4:3, 3:4)
47 - `resolution`: 分辨率(1K, 2K, 4K)
48 - `num_images`: 生成数量(1-4)
49- **示例**:
50 ```python
51 generate_image(
52 prompt="A majestic horse galloping through cherry blossoms, golden hour lighting, Chinese New Year festive atmosphere",
53 style="realistic",
54 aspect_ratio="16:9",
55 resolution="2K",
56 num_images=2
57 )
58 ```
59
60### edit_image
61- **用途**:编辑现有图像
62- **参数**:
63 - `image_path`: 原图路径或URL
64 - `prompt`: 编辑指令(如:"将背景改为夜景")
65 - `preserve_subject`: 是否保持主体不变(默认True)
66- **示例**:
67 ```python
68 edit_image(
69 image_path="/workspace/photo.jpg",
70 prompt="Add Chinese New Year decorations and red lanterns to the background",
71 preserve_subject=True
72 )
73 ```
74
75## Prompt 最佳实践
76
77### 基础公式
78```
79[主体] + [动作/姿态] + [场景/背景] + [风格] + [氛围/光线]
80```
81
82### 风格关键词
83- **写实**:photorealistic, hyperrealistic, 8K, detailed
84- **动漫**:anime style, Ghibli style, cel shading
85- **油画**:oil painting style, impressionist, Van Gogh style
86- **极简**:minimal, flat design, vector art
87- **电影感**:cinematic, dramatic lighting, movie poster style
88
89### 质量增强词
90- `high quality`, `detailed`, `sharp focus`
91- `professional photography`, `award winning`
92- `4K resolution`, `ultra detailed`
93
94### 避免事项
95- ❌ 避免模糊描述:"一张好看的图"
96- ❌ 避免矛盾描述:"写实风格的卡通"
97- ❌ 避免敏感内容
98- ✅ 具体、清晰、有层次
99
100## 应用场景模板
101
102### 场景1:微信红包封面/节日祝福图
103```yaml
104prompt_template: |
105 A {animal} in {pose}, surrounded by {decorations},
106 Chinese New Year theme, festive red and gold colors,
107 {style} style, high quality, {text_content}
108
109variables:
110 animal: "majestic horse" # 马年
111 pose: "running gracefully"
112 decorations: "cherry blossoms, red lanterns, gold coins"
113 style: "elegant illustration"
114 text_content: "with Chinese text '恭喜发财' in golden calligraphy"
115```
116
117### 场景2:演示文稿配图
118```yaml
119prompt_template: |
120 {concept} visualization, professional infographic style,
121 clean white background, modern corporate aesthetic,
122 subtle gradients, minimalist design
123
124variables:
125 concept: "AI workflow automation"
126```
127
128### 场景3:社交媒体内容
129```yaml
130prompt_template: |
131 {subject} {action}, {platform} optimized aspect ratio,
132 vibrant colors, eye-catching composition,
133 trending aesthetic, shareable content style
134
135variables:
136 subject: "coffee cup"
137 action: "with steam rising"
138 platform: "Instagram" # 1:1 or 4:5
139```
140
141## 输出格式
142
143### 生成结果展示
144```markdown
145## 🎨 图像生成完成
146
147**Prompt**: [使用的英文Prompt]
148
149**参数**:
150- 风格: [style]
151- 尺寸: [aspect_ratio]
152- 分辨率: [resolution]
153
154**生成结果**:
155
156
157**下一步**:
158- [ ] 满意,保存到指定位置
159- [ ] 需要调整风格/颜色
160- [ ] 需要修改特定部分
161- [ ] 重新生成
162```
163
164## 注意事项
165
1661. **版权合规**:生成的图像带有 SynthID 水印
1672. **内容政策**:遵守 Google 使用政策,不生成敏感内容
1683. **商业使用**:支持商业用途(营销、产品)
1694. **文字渲染**:Nano Banana Pro 支持多语言文字,但中文效果需要验证
1705. **角色一致性**:跨图保持角色特征需要使用参考图功能
171
172## 资源引用
173
174- `resources/prompt_templates.yaml` - 预设 Prompt 模板
175- `resources/style_presets.md` - 风格预设详解
176- `resources/chinese_new_year_2026.md` - 马年专属模板