nano-image-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano Image Generator
Nano图片生成工具
Generate images using Nano Banana Pro (Gemini 3 Pro Preview) for any visual asset needs.
使用Nano Banana Pro(Gemini 3 Pro预览版)满足各类视觉资产生成需求。
Requirements
配置要求
在项目根目录 中配置:
.env- (或
apikey)APIKEY - (或
baseurl,例如BASEURL)https://generativelanguage.googleapis.com/v1beta/models
兼容回退:若未找到 ,脚本会尝试 。
apikey/APIKEYGEMINI_API_KEY在项目根目录 中配置:
.env- (或
apikey)APIKEY - (或
baseurl,例如BASEURL)https://generativelanguage.googleapis.com/v1beta/models
兼容回退:若未找到 ,脚本会尝试 。
apikey/APIKEYGEMINI_API_KEYQuick Start
快速开始
bash
python scripts/generate_image.py "A friendly robot mascot waving" --output ./assets/mascot.pngbash
python scripts/generate_image.py "A friendly robot mascot waving" --output ./assets/mascot.pngScript Usage
脚本使用方法
bash
python scripts/generate_image.py <prompt> --output <path> [options]Required:
- - Image description
prompt - - Output file path
--output, -o
Options:
- - Aspect ratio (default:
--aspect, -a)1:1- Square:
1:1 - Portrait: ,
2:3,3:4,4:59:16 - Landscape: ,
3:2,4:3,5:4,16:921:9
- Square:
- - Resolution:
--size, -s,1K(default),2K4K
bash
python scripts/generate_image.py <prompt> --output <path> [options]必填参数:
- - 图片描述
prompt - - 输出文件路径
--output, -o
可选参数:
- - 宽高比(默认值:
--aspect, -a)1:1- 正方形:
1:1 - 竖版:,
2:3,3:4,4:59:16 - 横版:,
3:2,4:3,5:4,16:921:9
- 正方形:
- - 分辨率:
--size, -s、1K(默认)、2K4K
Workflow
工作流程
-
Determine output location - Place images where contextually appropriate:
- App icons → or
./assets/icons/./public/icons/ - Marketing → or
./marketing/./assets/images/ - UI elements → or
./src/assets/./public/images/ - General →
./generated/
- App icons →
-
Craft effective prompts - Be specific and descriptive:
- Include style: "flat design", "3D rendered", "watercolor", "minimalist"
- Include context: "for a mobile app", "website hero image", "social media post"
- Include details: colors, mood, composition
-
Choose appropriate settings:
- Icons/logos →
--aspect 1:1 - Banners/headers →
--aspect 16:9 - Mobile screens →
--aspect 9:16 - Photos → or
--aspect 3:24:3
- Icons/logos →
-
确定输出位置 - 根据使用场景选择合适的存放路径:
- 应用图标 → 或
./assets/icons/./public/icons/ - 营销素材 → 或
./marketing/./assets/images/ - UI元素 → 或
./src/assets/./public/images/ - 通用素材 →
./generated/
- 应用图标 →
-
撰写高效提示词 - 内容需具体且描述清晰:
- 包含风格:"flat design"(扁平化设计)、"3D rendered"(3D渲染)、"watercolor"(水彩风格)、"minimalist"(极简风格)
- 包含使用场景:"for a mobile app"(用于移动应用)、"website hero image"(网站首屏图)、"social media post"(社交媒体帖子)
- 包含细节:颜色、氛围、构图
-
选择合适的参数设置:
- 图标/Logo →
--aspect 1:1 - 横幅/页眉 →
--aspect 16:9 - 移动端屏幕 →
--aspect 9:16 - 照片类 → 或
--aspect 3:24:3
- 图标/Logo →
Examples
使用示例
App icon:
bash
python scripts/generate_image.py "Minimalist flat design app icon of a lightning bolt, purple gradient background, modern iOS style" \
--output ./assets/app-icon.png --aspect 1:1Marketing banner:
bash
python scripts/generate_image.py "Professional website hero banner for a productivity app, abstract geometric shapes, blue and white color scheme, modern and clean" \
--output ./public/images/hero-banner.png --aspect 16:9High-quality illustration:
bash
python scripts/generate_image.py "Detailed isometric illustration of a cozy home office setup with plants, warm lighting, digital art style" \
--output ./assets/illustrations/office.png --size 4K应用图标:
bash
python scripts/generate_image.py "Minimalist flat design app icon of a lightning bolt, purple gradient background, modern iOS style" \
--output ./assets/app-icon.png --aspect 1:1营销横幅:
bash
python scripts/generate_image.py "Professional website hero banner for a productivity app, abstract geometric shapes, blue and white color scheme, modern and clean" \
--output ./public/images/hero-banner.png --aspect 16:9高质量插画:
bash
python scripts/generate_image.py "Detailed isometric illustration of a cozy home office setup with plants, warm lighting, digital art style" \
--output ./assets/illustrations/office.png --size 4KPrompt Tips
提示词撰写技巧
- Be specific - "A red apple on a wooden table" vs "an apple"
- Include style - "in the style of pixel art" or "photorealistic"
- Mention purpose - "for a children's book" affects the output style
- Describe composition - "centered", "rule of thirds", "close-up"
- Specify colors - Explicit color palettes yield better results
- Avoid - Don't ask for text in images (use overlays instead)
- 内容具体 - 对比“木桌上的红苹果”和“一个苹果”
- 明确风格 - 例如“像素艺术风格”或“照片级写实”
- 说明用途 - 标注“用于儿童书籍”会影响输出风格
- 描述构图 - 如“居中布局”“三分法构图”“特写”
- 指定颜色 - 明确的配色方案能获得更理想的结果
- 注意避坑 - 不要要求在图片中生成文字(建议使用叠加层添加)