gemini-image-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGemini Image Generator
Gemini图片生成工具
Generate images using Google Gemini's image generation capabilities.
借助Google Gemini的图片生成功能来创建图片。
Prerequisites
前置要求
- Python 3.8+
- Google AI Studio API key
- Virtual environment with dependencies
- Python 3.8+
- Google AI Studio API密钥
- 包含依赖项的虚拟环境
Setup
设置步骤
bash
undefinedbash
undefinedNavigate to scripts directory
Navigate to scripts directory
cd scripts
cd scripts
Create virtual environment
Create virtual environment
python3 -m venv venv
python3 -m venv venv
Install dependencies
Install dependencies
./venv/bin/pip install -r requirements.txt # Unix
./venv/bin/pip install -r requirements.txt # Unix
or
or
.\venv\Scripts\pip install -r requirements.txt # Windows
.\venv\Scripts\pip install -r requirements.txt # Windows
Set API key
Set API key
export GEMINI_API_KEY="your-api-key" # Unix
export GEMINI_API_KEY="your-api-key" # Unix
or
or
$env:GEMINI_API_KEY = "your-api-key" # PowerShell
Get your API key from [Google AI Studio](https://aistudio.google.com/apikey).$env:GEMINI_API_KEY = "your-api-key" # PowerShell
从[Google AI Studio](https://aistudio.google.com/apikey)获取你的API密钥。Usage
使用方法
Basic Text-to-Image
基础文本转图片
bash
python generate.py --prompt "A serene mountain landscape at sunset" --output landscape.pngbash
python generate.py --prompt "A serene mountain landscape at sunset" --output landscape.pngWith Reference Image (Style Transfer)
结合参考图片(风格迁移)
bash
python generate.py --prompt "Same scene but in winter" --reference landscape.png --output winter.pngbash
python generate.py --prompt "Same scene but in winter" --reference landscape.png --output winter.pngPrompt Engineering Tips
提示词设计技巧
For best results, structure prompts as:
[Subject] + [Style] + [Composition] + [Technical] + [Mood]Example for game assets:
"A bio-mimetic robot with Art Nouveau brass gears and botanical vine patterns,
centered composition on transparent background, flat vector style suitable for
game sprite, warm golden hour lighting, whimsical and charming mood"Style keywords that work well:
- Art styles: Art Nouveau, steampunk, Studio Ghibli, pixel art, vector illustration
- Technical: transparent background, game sprite, icon, UI element, seamless texture
- Mood: whimsical, dramatic, cozy, ethereal, vibrant
为获得最佳效果,请按照以下结构设计提示词:
[主体] + [风格] + [构图] + [技术要求] + [氛围]游戏资产示例:
"A bio-mimetic robot with Art Nouveau brass gears and botanical vine patterns,
centered composition on transparent background, flat vector style suitable for
game sprite, warm golden hour lighting, whimsical and charming mood"效果较好的风格关键词:
- 艺术风格:新艺术运动(Art Nouveau)、蒸汽朋克、吉卜力工作室风格、像素画、矢量插画
- 技术要求:透明背景、游戏精灵、图标、UI元素、无缝纹理
- 氛围:奇幻、戏剧性、温馨、空灵、充满活力
Parameters
参数说明
| Parameter | Required | Description |
|---|---|---|
| Yes | Text description of desired image |
| Yes | Output file path (.png) |
| No | Reference image for style guidance |
| 参数 | 是否必填 | 描述 |
|---|---|---|
| 是 | 所需图片的文本描述 |
| 是 | 输出文件路径(.png格式) |
| 否 | 用于风格引导的参考图片 |
Troubleshooting
故障排除
| Error | Solution |
|---|---|
| API key not valid | Check GEMINI_API_KEY is set correctly |
| 403 Forbidden | API key may have IP restrictions |
| Model not found | Model names change; check Google AI docs |
| No image generated | Try simpler prompt, check API quota |
| 错误 | 解决方案 |
|---|---|
| API密钥无效 | 检查GEMINI_API_KEY是否配置正确 |
| 403 禁止访问 | API密钥可能存在IP限制 |
| 模型未找到 | 模型名称可能已变更,请查看Google AI文档 |
| 未生成图片 | 尝试使用更简单的提示词,检查API配额 |
Integration with Game Assets Team
与游戏资产团队的集成
This skill is the primary image generation tool for the skill. Use it for:
game-assets-team- Concept art exploration
- UI element generation
- Character/Simulin designs
- Background and environment art
- Promotional materials
Always follow the art direction guidelines in game-assets-team for consistent visual style.
本工具是工具的主要图片生成工具。可用于:
game-assets-team- 概念艺术探索
- UI元素生成
- 角色/模拟生物设计
- 背景与环境艺术
- 宣传物料
请始终遵循游戏资产团队的艺术指导规范,以保持视觉风格的一致性。