Loading...
Loading...
Compare original and translation side by side
google-genaiGEMINI_API_KEYgoogle-genaiGEMINI_API_KEYpip install google-genaipip install google-genaiexport GEMINI_API_KEY="your-api-key"~/.zshrc~/.bashrcecho 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrcexport GEMINI_API_KEY="your-api-key"~/.zshrc~/.bashrcecho 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrcpython scripts/generate_image.py -p "A fluffy orange cat sitting on a windowsill, warm sunlight, cozy atmosphere"python scripts/generate_image.py -p "Modern tech startup banner" -a 16:9 -o banner.pngpython scripts/generate_image.py -p "Make the sky more dramatic with sunset colors" -i photo.jpg -o edited.pngpython scripts/generate_image.py -p "A fluffy orange cat sitting on a windowsill, warm sunlight, cozy atmosphere"python scripts/generate_image.py -p "Modern tech startup banner" -a 16:9 -o banner.pngpython scripts/generate_image.py -p "Make the sky more dramatic with sunset colors" -i photo.jpg -o edited.pngpython scripts/generate_image.py [options]
Required:
-p, --prompt TEXT Text prompt describing the image
Optional:
-o, --output PATH Output file path (default: auto-generated)
-m, --model MODEL Model to use (default: gemini-3-pro-image-preview)
-a, --aspect-ratio RATIO Aspect ratio (default: 1:1)
-s, --size SIZE Image size: 1K, 2K, 4K (default: 1K, Pro only)
-i, --input-image PATH Input image for editing mode
-r, --reference-images Reference image(s), can be repeated (max 14)
-v, --verbose Show detailed progresspython scripts/generate_image.py [options]
必填参数:
-p, --prompt TEXT 描述图像的文本提示词
可选参数:
-o, --output PATH 输出文件路径(默认:自动生成)
-m, --model MODEL 使用的模型(默认:gemini-3-pro-image-preview)
-a, --aspect-ratio RATIO 宽高比(默认:1:1)
-s, --size SIZE 图像尺寸:1K、2K、4K(默认:1K,仅Pro模型支持)
-i, --input-image PATH 编辑模式下的输入图像路径
-r, --reference-images 参考图像,可重复添加(最多14张)
-v, --verbose 展示详细生成进度| Model | Resolution | Best For |
|---|---|---|
| Up to 4K | Final assets, high quality, professional work |
| 1024px | Quick iterations, prototyping, batch generation |
python scripts/generate_image.py -p "Quick concept sketch" -m gemini-2.5-flash-image| 模型 | 分辨率 | 适用场景 |
|---|---|---|
| 最高4K | 最终产出资源、高品质要求、专业工作场景 |
| 1024px | 快速迭代、原型制作、批量生成场景 |
python scripts/generate_image.py -p "Quick concept sketch" -m gemini-2.5-flash-image| Ratio | Use Case |
|---|---|
| App icons, profile pictures, thumbnails |
| Portrait photos, book covers |
| Landscape photos, postcards |
| Portrait photos, social media posts |
| Traditional photos, presentations |
| Instagram posts, portrait social media |
| Large format prints |
| Stories, vertical videos, mobile wallpapers |
| Widescreen banners, video thumbnails, headers |
| Ultrawide banners, cinematic headers |
| 比例 | 适用场景 |
|---|---|
| 应用图标、头像、缩略图 |
| 竖版照片、书籍封面 |
| 横版照片、明信片 |
| 竖版照片、社交媒体帖子 |
| 传统照片、演示文稿 |
| Instagram帖子、竖版社交内容 |
| 大幅打印素材 |
| 短视频故事、竖版视频、手机壁纸 |
| 宽屏横幅、视频缩略图、页面头部 |
| 超宽横幅、电影感页面头部 |
| Size | Resolution | Use Case |
|---|---|---|
| 1024px | Web graphics, thumbnails |
| 2048px | Print materials, detailed graphics |
| 4096px | High-resolution prints, large displays |
python scripts/generate_image.py -p "Detailed landscape" -s 4K -o landscape_4k.png| 尺寸 | 分辨率 | 适用场景 |
|---|---|---|
| 1024px | 网页图形、缩略图 |
| 2048px | 打印素材、精细图形 |
| 4096px | 高分辨率打印、大型显示设备 |
python scripts/generate_image.py -p "Detailed landscape" -s 4K -o landscape_4k.png[Subject] + [Style] + [Details] + [Quality modifiers][主体] + [风格] + [细节] + [画质修饰词]Bad: "a cat"
Good: "a fluffy orange tabby cat sitting on a windowsill"负面示例: "a cat"
正面示例: "a fluffy orange tabby cat sitting on a windowsill"Minimalist app icon for a weather app, blue gradient background,
white cloud with golden sun rays, flat design, rounded corners,
iOS style, clean and modernProfessional tech startup banner, abstract geometric shapes
flowing from left to right, purple and blue gradient,
modern and clean aesthetic, corporate stylePixel art character sprite, fantasy warrior with glowing sword,
32x32 style, transparent background, retro 16-bit game aesthetic,
vibrant colorsProfessional product photo of wireless earbuds on white background,
soft shadows, studio lighting, minimalist composition,
commercial photography styleFuturistic city skyline at sunset, flying vehicles between
towering skyscrapers, neon lights reflecting on wet streets,
cyberpunk atmosphere, cinematic composition, detailedAbstract gradient background for mobile app, soft purple to pink
transition, subtle geometric patterns, modern and minimal,
suitable for dark text overlayMinimalist app icon for a weather app, blue gradient background,
white cloud with golden sun rays, flat design, rounded corners,
iOS style, clean and modernProfessional tech startup banner, abstract geometric shapes
flowing from left to right, purple and blue gradient,
modern and clean aesthetic, corporate stylePixel art character sprite, fantasy warrior with glowing sword,
32x32 style, transparent background, retro 16-bit game aesthetic,
vibrant colorsProfessional product photo of wireless earbuds on white background,
soft shadows, studio lighting, minimalist composition,
commercial photography styleFuturistic city skyline at sunset, flying vehicles between
towering skyscrapers, neon lights reflecting on wet streets,
cyberpunk atmosphere, cinematic composition, detailedAbstract gradient background for mobile app, soft purple to pink
transition, subtle geometric patterns, modern and minimal,
suitable for dark text overlaypython scripts/generate_image.py -p "Your description here" -o output.pngpython scripts/generate_image.py -p "Your description here" -o output.pngpython scripts/generate_image.py \
-p "Change the background to a tropical beach at sunset" \
-i original.jpg \
-o edited.pngpython scripts/generate_image.py \
-p "Change the background to a tropical beach at sunset" \
-i original.jpg \
-o edited.pngpython scripts/generate_image.py \
-p "Create a new character in this art style" \
-r style_ref1.png \
-r style_ref2.png \
-o new_character.pngpython scripts/generate_image.py \
-p "Create a new character in this art style" \
-r style_ref1.png \
-r style_ref2.png \
-o new_character.pngundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedexport GEMINI_API_KEY="your-api-key"export GEMINI_API_KEY="your-api-key"gemini-3-pro-image-previewgemini-3-pro-image-preview