image-generation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Generation Skill
图像生成Skill
Overview
概述
Image Generation uses FAL.ai nanobanana pro to create professional-quality images from text descriptions. This skill teaches you how to craft effective prompts and use the automation system to generate assets directly in Claude Code.
Keywords: image generation, nanobanana pro, prompt engineering, AI art, visual content creation, asset generation, automation
图像生成功能使用FAL.ai nanobanana pro根据文本描述创建专业级别的图片。本Skill将教你如何设计有效的提示词,并使用自动化系统在Claude Code中直接生成资产。
关键词:图像生成、nanobanana pro、提示词工程、AI艺术、视觉内容创作、资产生成、自动化
Core Models
核心模型
nanobanana pro — Recommended
nanobanana pro — 推荐使用
- Quality: Highest, most detailed
- Speed: 30-60 seconds
- Best For: Product photography, hero images, final assets
- Use Case: When quality matters most
- 画质:最高,细节最丰富
- 速度:30-60秒
- 最佳适用场景:产品摄影、主视觉图、最终资产
- 使用时机:对画质要求最高时
nanobanana pro
nanobanana pro
- Quality: High, good detail
- Speed: 5-15 seconds
- Best For: Testing, iterations, social media
- Use Case: When speed matters
- 画质:高,细节出色
- 速度:5-15秒
- 最佳适用场景:测试、迭代、社交媒体内容
- 使用时机:对速度要求最高时
nanobanana pro
nanobanana pro
- Quality: Latest, improved
- Speed: 20-40 seconds
- Best For: Production work
- Use Case: When you want the latest model
- 画质:最新版本,效果优化
- 速度:20-40秒
- 最佳适用场景:生产级工作
- 使用时机:想要使用最新模型时
Prompt Engineering Framework
提示词工程框架
The 5-Part Prompt Formula
五部分提示词公式
Every effective prompt has 5 components:
1. Subject — What is the main thing?
"A luxury leather watch"
"A modern logo"
"An Instagram post graphic"2. Description — What does it look like?
"with gold accents and brown leather strap"
"geometric style, minimalist design"
"vibrant colors, eye-catching composition"3. Style — What's the artistic style?
"professional product photography"
"modern illustration"
"digital design"
"photorealistic"4. Technical Details — Quality and format specs
"studio lighting, sharp focus, 4K, centered composition"
"high contrast, trending design, professional quality"
"detailed, well-lit, professional photography"5. Mood/Aesthetic — What's the feeling?
"luxury and professional"
"energetic and modern"
"clean and minimalist"
"warm and inviting"每个有效的提示词包含5个组成部分:
1. 主体 — 核心对象是什么?
"一块奢华皮质手表"
"一个现代标志"
"一张Instagram帖子配图"2. 细节描述 — 它看起来是什么样的?
"带有金色装饰和棕色皮质表带"
"几何风格,极简设计"
"色彩鲜艳,吸睛构图"3. 风格 — 艺术风格是什么?
"专业产品摄影风格"
"现代插画风格"
"数字设计风格"
"写实风格"4. 技术细节 — 画质和格式规格
"影棚灯光,清晰对焦,4K分辨率,居中构图"
"高对比度,潮流设计,专业画质"
"细节丰富,光线充足,专业摄影风格"5. 氛围/美学 — 传递什么感觉?
"奢华且专业"
"充满活力且现代"
"简洁且极简"
"温暖且有吸引力"Complete Prompt Example
完整提示词示例
A luxury leather watch with gold accents and brown strap,
professional product photography, studio lighting with rim light,
centered composition, sharp focus, 4K, luxury and professional mood一块带有金色装饰和棕色皮质表带的奢华皮质手表,
专业产品摄影风格,带轮廓光的影棚灯光,
居中构图,清晰对焦,4K分辨率,奢华专业的氛围Prompt Engineering Techniques
提示词工程技巧
Technique 1: Be Specific
❌ Bad: "A watch"
✅ Good: "A luxury leather watch with gold accents on white background"Technique 2: Use Descriptive Adjectives
❌ Bad: "A logo"
✅ Good: "A modern, geometric, minimalist logo in blue and white"Technique 3: Reference Styles
❌ Bad: "A nice graphic"
✅ Good: "A graphic in the style of modern Instagram design trends"Technique 4: Specify Quality
❌ Bad: "A photo"
✅ Good: "A professional 4K product photograph with studio lighting"Technique 5: Include Composition
❌ Bad: "A person"
✅ Good: "A person in rule of thirds composition, natural lighting, centered"技巧1:描述要具体
❌ 不佳:"一块手表"
✅ 优秀:"一块白色背景下带有金色装饰的奢华皮质手表"技巧2:使用描述性形容词
❌ 不佳:"一个标志"
✅ 优秀:"蓝白配色的现代几何极简标志"技巧3:参考风格流派
❌ 不佳:"一张好看的图形"
✅ 优秀:"符合现代Instagram设计趋势的图形"技巧4:明确画质要求
❌ 不佳:"一张照片"
✅ 优秀:"带有影棚灯光的专业4K产品照片"技巧5:包含构图要求
❌ 不佳:"一个人"
✅ 优秀:"采用三分法构图、自然光线、居中的人物"Claude Code Integration
Claude Code集成
How to Use in Claude Code
如何在Claude Code中使用
Claude Code can directly generate images using the automation system:
python
from claude_integration import generate_assetClaude Code可通过自动化系统直接生成图片:
python
from claude_integration import generate_assetGenerate a single image
生成单张图片
result = generate_asset(
category="product-photos",
name="luxury-watch",
prompt="A luxury leather watch with gold accents on white background, professional product photography, studio lighting, 4K, sharp focus",
size="1024x1024",
num_variations=1
)
print(f"Generated: {result['images']}")
undefinedresult = generate_asset(
category="product-photos",
name="luxury-watch",
prompt="一块白色背景下带有金色装饰的奢华皮质手表,专业产品摄影风格,影棚灯光,4K分辨率,清晰对焦",
size="1024x1024",
num_variations=1
)
print(f"已生成:{result['images']}")
undefinedSetup for Claude Code
Claude Code配置步骤
Ensure these files are in your project:
your-project/
├── vibe-creative-automation/
│ ├── fal_api.py
│ ├── creative_cli.py
│ ├── claude_integration.py
│ └── requirements.txt
└── assets/ (will be created automatically)Set environment variable:
bash
export FAL_API_KEY="your_key_here"Install dependencies:
bash
pip install requests确保项目中包含以下文件:
your-project/
├── vibe-creative-automation/
│ ├── fal_api.py
│ ├── creative_cli.py
│ ├── claude_integration.py
│ └── requirements.txt
└── assets/ (将自动创建)设置环境变量:
bash
export FAL_API_KEY="your_key_here"安装依赖:
bash
pip install requestsClaude Code Workflow
Claude Code工作流程
When you ask Claude: "Generate 3 variations of a product photo for my watch"
Claude will:
- Read Image Generation skill to understand prompting
- Read Creative Strategist to get your style
- Craft the prompt combining both
- Call automation system with the prompt
- Generate 3 images using FLUX model
- Save to folder like
assets/product-photos/luxury-watch/ - Show you results with file paths
当你向Claude提问:"为我的手表生成3张不同版本的产品照片"
Claude将:
- 读取图像生成Skill以理解提示词设计方法
- 读取创意策略师Skill以匹配你的风格
- 结合两者设计提示词
- 调用自动化系统传入提示词
- 使用FLUX模型生成3张图片
- 保存到指定文件夹,例如
assets/product-photos/luxury-watch/ - 向你展示结果及文件路径
Example: Claude Code Generates Product Photos
示例:Claude Code生成产品照片
python
from claude_integration import generate_assetpython
from claude_integration import generate_assetYour Creative Strategist style (from your style guide)
你的创意策略师风格(来自你的风格指南)
YOUR_STYLE = {
"primary_style": "photorealistic",
"mood": "professional and luxurious",
"lighting": "studio lighting with rim light",
"composition": "centered"
}
YOUR_STYLE = {
"primary_style": "写实风格",
"mood": "专业且奢华",
"lighting": "带轮廓光的影棚灯光",
"composition": "居中"
}
Generate product photo using your style
使用你的风格生成产品照片
prompt = f"""
A luxury leather watch with gold accents,
{YOUR_STYLE['primary_style']},
{YOUR_STYLE['mood']},
{YOUR_STYLE['lighting']},
{YOUR_STYLE['composition']},
white background,
4K,
sharp focus,
professional product photography
"""
result = generate_asset(
category="product-photography",
name="luxury-watch",
prompt=prompt,
size="1024x1024",
num_variations=3
)
for img_path in result['images']:
print(f"✅ Generated: {img_path}")
undefinedprompt = f"""
一块带有金色装饰的奢华皮质手表,
{YOUR_STYLE['primary_style']},
{YOUR_STYLE['mood']},
{YOUR_STYLE['lighting']},
{YOUR_STYLE['composition']},
白色背景,
4K分辨率,
清晰对焦,
专业产品摄影风格
"""
result = generate_asset(
category="product-photography",
name="luxury-watch",
prompt=prompt,
size="1024x1024",
num_variations=3
)
for img_path in result['images']:
print(f"✅ 已生成:{img_path}")
undefinedBatch Generation Example
批量生成示例
python
from claude_integration import batch_generate_assetspython
from claude_integration import batch_generate_assetsGenerate multiple assets at once
一次性生成多个资产
assets = [
{
"type": "custom",
"category": "product-photos",
"name": "watch",
"prompt": "Luxury watch, professional photography, studio lighting, 4K"
},
{
"type": "custom",
"category": "product-photos",
"name": "wallet",
"prompt": "Premium leather wallet, professional photography, studio lighting, 4K"
},
{
"type": "custom",
"category": "product-photos",
"name": "sunglasses",
"prompt": "Designer sunglasses, professional photography, studio lighting, 4K"
}
]
results = batch_generate_assets(assets)
for result in results:
print(f"{result['asset_name']}: {result['images']}")
undefinedassets = [
{
"type": "custom",
"category": "product-photos",
"name": "watch",
"prompt": "奢华手表,专业摄影风格,影棚灯光,4K分辨率"
},
{
"type": "custom",
"category": "product-photos",
"name": "wallet",
"prompt": "高端皮质钱包,专业摄影风格,影棚灯光,4K分辨率"
},
{
"type": "custom",
"category": "product-photos",
"name": "sunglasses",
"prompt": "设计师款太阳镜,专业摄影风格,影棚灯光,4K分辨率"
}
]
results = batch_generate_assets(assets)
for result in results:
print(f"{result['asset_name']}: {result['images']}")
undefinedImage Sizes
图片尺寸选择
Choose the right size for your use case:
| Size | Use Case | Speed | Detail |
|---|---|---|---|
| 512x512 | Testing, thumbnails | Fast | Good |
| 768x768 | Social media, web | Medium | Good |
| 1024x1024 | Product photos, hero images | Medium | Excellent |
| 1536x1536 | Large prints, high-res | Slow | Excellent |
| 2048x2048 | 4K, maximum detail | Very Slow | Maximum |
根据你的使用场景选择合适的尺寸:
| 尺寸 | 使用场景 | 速度 | 细节 |
|---|---|---|---|
| 512x512 | 测试、缩略图 | 快 | 良好 |
| 768x768 | 社交媒体、网页 | 中等 | 良好 |
| 1024x1024 | 产品照片、主视觉图 | 中等 | 极佳 |
| 1536x1536 | 大幅打印、高分辨率内容 | 慢 | 极佳 |
| 2048x2048 | 4K、最高细节 | 极慢 | 极致 |
Generation Parameters
生成参数
Guidance Scale (3.5 - 7.5)
引导尺度(3.5 - 7.5)
Controls how strictly the model follows your prompt:
3.5 — More creative freedom, less literal
5.0 — Balanced (recommended)
7.5 — Strict adherence to prompt, more literalExample:
python
undefined控制模型对提示词的遵循严格程度:
3.5 — 创意自由度更高,字面匹配度较低
5.0 — 平衡效果(推荐)
7.5 — 严格遵循提示词,字面匹配度更高示例:
python
undefinedMore creative
更具创意
result = generate_asset(..., guidance_scale=3.5)
result = generate_asset(..., guidance_scale=3.5)
Balanced (default)
平衡效果(默认)
result = generate_asset(..., guidance_scale=5.0)
result = generate_asset(..., guidance_scale=5.0)
Strict
严格遵循
result = generate_asset(..., guidance_scale=7.5)
undefinedresult = generate_asset(..., guidance_scale=7.5)
undefinedInference Steps (20 - 50)
推理步数(20 - 50)
More steps = higher quality but slower:
20 — Fast, acceptable quality
28 — Balanced (default)
40 — High quality
50 — Maximum qualityExample:
python
undefined步数越多,画质越高但速度越慢:
20 — 生成快,画质可接受
28 — 平衡效果(默认)
40 — 高画质
50 — 最高画质示例:
python
undefinedFast generation
快速生成
result = generate_asset(..., inference_steps=20)
result = generate_asset(..., inference_steps=20)
Balanced (default)
平衡效果(默认)
result = generate_asset(..., inference_steps=28)
result = generate_asset(..., inference_steps=28)
High quality
高画质
result = generate_asset(..., inference_steps=40)
undefinedresult = generate_asset(..., inference_steps=40)
undefinedPractical Prompt Examples
实用提示词示例
Product Photography
产品摄影
A luxury leather watch with gold accents on white background,
professional product photography, studio lighting with rim light,
centered composition, sharp focus, 4K, highly detailed一块白色背景下带有金色装饰的奢华皮质手表,
专业产品摄影风格,带轮廓光的影棚灯光,
居中构图,清晰对焦,4K分辨率,细节丰富Social Media Graphic
社交媒体图形
Instagram post graphic for product launch, vibrant colors,
eye-catching composition, modern design, 1080x1080 format,
trending aesthetic, professional quality产品发布用Instagram帖子图形,色彩鲜艳,
吸睛构图,现代设计,1080x1080格式,
潮流美学,专业画质Logo Design
标志设计
Modern tech company logo, geometric style, blue and white colors,
minimalist design, scalable, professional, clean lines,
suitable for all media科技公司现代标志,几何风格,蓝白配色,
极简设计,可缩放,专业风格,线条简洁,
适用于所有媒体场景Illustration
插画
Colorful illustration of a person working at a computer,
modern illustration style, bright colors, friendly mood,
professional quality, trending design一个人在电脑前工作的彩色插画,
现代插画风格,明亮色彩,友好氛围,
专业画质,潮流设计Hero Image
主视觉图
A futuristic tech workspace with multiple monitors,
professional photography, modern aesthetic, blue and purple lighting,
cinematic composition, 4K, highly detailed带有多台显示器的未来科技工作空间,
专业摄影风格,现代美学,蓝紫色灯光,
电影级构图,4K分辨率,细节丰富Integration with Other Skills
与其他Skill的集成
Image Generation + Creative Strategist:
- Use your style guide to craft better prompts
- Maintain consistency across all generated images
Image Generation + Product Photography:
- Generate product shots for e-commerce
- Create lifestyle product photos
Image Generation + Social Graphics:
- Generate graphics for social media
- Create platform-specific content
Image Generation + Brand Asset:
- Generate logos and icons
- Create brand illustrations
图像生成 + 创意策略师:
- 使用你的风格指南设计更好的提示词
- 保持所有生成图片的风格一致性
图像生成 + 产品摄影:
- 为电商平台生成产品照片
- 创建生活化产品照片
图像生成 + 社交媒体图形:
- 为社交媒体生成图形内容
- 创建适配不同平台的内容
图像生成 + 品牌资产:
- 生成标志和图标
- 创建品牌插画
Command Line Usage
命令行使用方式
You can also use the CLI directly:
bash
undefined你也可以直接使用CLI:
bash
undefinedGenerate custom asset
生成自定义资产
python creative_cli.py custom
--category "product-photos"
--name "luxury-watch"
--prompt "A luxury leather watch with gold accents on white background, professional product photography, studio lighting, 4K, sharp focus"
--size 1024x1024
--num-images 3
--model fal-ai/nano-banana-pro
--category "product-photos"
--name "luxury-watch"
--prompt "A luxury leather watch with gold accents on white background, professional product photography, studio lighting, 4K, sharp focus"
--size 1024x1024
--num-images 3
--model fal-ai/nano-banana-pro
undefinedpython creative_cli.py custom
--category "product-photos"
--name "luxury-watch"
--prompt "一块白色背景下带有金色装饰的奢华皮质手表,专业产品摄影风格,影棚灯光,4K分辨率,清晰对焦"
--size 1024x1024
--num-images 3
--model fal-ai/nano-banana-pro
--category "product-photos"
--name "luxury-watch"
--prompt "一块白色背景下带有金色装饰的奢华皮质手表,专业产品摄影风格,影棚灯光,4K分辨率,清晰对焦"
--size 1024x1024
--num-images 3
--model fal-ai/nano-banana-pro
undefinedTroubleshooting
故障排除
Problem: Images don't match my style
问题:生成的图片不符合我的风格
Solution:
- Add more specific style descriptors to prompt
- Reference your Creative Strategist guide
- Test with different guidance scales
- Generate multiple variations
解决方案:
- 在提示词中添加更具体的风格描述
- 参考你的创意策略师指南
- 尝试不同的引导尺度
- 生成多个版本的图片
Problem: Generation is too slow
问题:生成速度太慢
Solution:
- Use model
fal-ai/nano-banana-pro - Reduce image size to 768x768
- Reduce inference steps to 20
解决方案:
- 使用模型
fal-ai/nano-banana-pro - 将图片尺寸缩小至768x768
- 将推理步数减少至20
Problem: Images are too creative/not literal enough
问题:图片过于创意/与提示词不符
Solution:
- Increase guidance scale to 7.5
- Be more specific in prompt
- Add more technical details
解决方案:
- 将引导尺度提高至7.5
- 提示词描述更具体
- 添加更多技术细节
Problem: API errors
问题:API调用出错
Solution:
- Verify FAL_API_KEY is set correctly
- Check internet connection
- Verify API key is valid
- Try again after a moment
解决方案:
- 验证FAL_API_KEY是否正确设置
- 检查网络连接
- 验证API密钥是否有效
- 稍后重试
Best Practices
最佳实践
- Start with Creative Strategist — Define your style first
- Be Specific — More details = better results
- Test Variations — Generate multiple versions
- Iterate — Refine based on results
- Use Consistent Prompts — Similar prompts = consistent style
- Reference Your Style — Include style descriptors in every prompt
- Batch Generate — Generate multiple assets at once
- Organize Assets — Keep generated images organized
- 先使用创意策略师 — 先定义你的风格
- 描述要具体 — 细节越多,结果越好
- 测试多个版本 — 生成多种变体
- 迭代优化 — 根据结果调整提示词
- 使用一致的提示词 — 相似提示词可保证风格一致
- 参考你的风格 — 在每个提示词中包含风格描述
- 批量生成 — 一次性生成多个资产
- 整理资产 — 有序管理生成的图片
Next Steps
后续步骤
- Define Your Style — Complete Creative Strategist first
- Craft Your Prompt — Use the 5-part formula
- Test Generation — Generate a test image
- Iterate — Refine based on results
- Batch Generate — Create multiple assets
- Use in Projects — Integrate with other skills
You now have the power to generate professional images with AI. Start creating! 🎨
- 定义你的风格 — 先完成创意策略师Skill
- 设计提示词 — 使用五部分公式
- 测试生成 — 生成一张测试图片
- 迭代优化 — 根据结果调整
- 批量生成 — 创建多个资产
- 在项目中使用 — 与其他Skill集成
你现在拥有了用AI生成专业图片的能力。开始创作吧! 🎨