Gemini Image Gen
Generate and edit images via the Google Gemini API using pure Python stdlib. Supports Gemini native generation + editing, Imagen 3 generation, batch runs, and an HTML gallery output.
Quick Start
export GEMINI_API_KEY="your-key-here"
# Default: Gemini native, 4 random prompts
python3 scripts/gen.py
# Custom prompt
python3 scripts/gen.py --prompt "a cyberpunk cat riding a neon motorcycle through Tokyo at night"
# Imagen 3 engine
python3 scripts/gen.py --engine imagen --count 4 --aspect 16:9
# Edit an existing image (Gemini engine only)
python3 scripts/gen.py --edit path/to/image.png --prompt "change the background to a sunset beach"
# Use a style preset
python3 scripts/gen.py --style watercolor --prompt "floating islands above a calm sea"
# List available styles
python3 scripts/gen.py --styles
Style Presets
| Style |
Description |
photo |
Ultra-detailed photorealistic photography, 8K resolution, sharp focus |
anime |
High-quality anime illustration, Studio Ghibli inspired, vibrant colors |
watercolor |
Delicate watercolor painting on textured paper, soft edges, gentle color bleeding |
cyberpunk |
Neon-lit cyberpunk scene, rain-soaked streets, holographic displays, Blade Runner aesthetic |
minimalist |
Clean minimalist design, geometric shapes, limited color palette, white space |
oil-painting |
Classical oil painting with visible brushstrokes, rich textures, Renaissance lighting |
pixel-art |
Detailed pixel art, retro 16-bit style, crisp edges, nostalgic palette |
sketch |
Pencil sketch on cream paper, hatching and cross-hatching, artistic imperfections |
3d-render |
Professional 3D render, ambient occlusion, global illumination, photorealistic materials |
pop-art |
Bold pop art style, Ben-Day dots, strong outlines, vibrant contrasting colors |
Full CLI Reference
| Flag |
Default |
Description |
--prompt |
(random) |
Text prompt. Omit for random creative prompts |
--count |
4 |
Number of images to generate |
--engine |
gemini |
Engine: gemini (native, supports edit) or imagen (Imagen 3) |
--model |
(auto) |
Model override. Default: gemini-2.5-flash-image or imagen-3.0-generate-002 |
--edit |
|
Path to input image for editing (Gemini engine only) |
--aspect |
1:1 |
Aspect ratio for Imagen: 1:1, 16:9, 9:16, 4:3, 3:4 |
--out-dir |
(auto) |
Output directory (default is a timestamped folder) |
--style |
|
Style preset to prepend to the prompt |
--styles |
|
List available style presets and exit |
Python Example
import subprocess
subprocess.run(
[
"python3",
"scripts/gen.py",
"--prompt",
"a serene mountain landscape at golden hour",
"--count",
"4",
"--style",
"photo",
],
check=True,
)
Troubleshooting
- Missing API key: set
GEMINI_API_KEY in your environment and retry.
- Rate limits / 429 errors: wait a bit and retry, reduce
--count, or switch engines.
- Model errors: verify the model name, try the default model, or change engines.
Integration with Other Skills
- AgentGram — Share your generated images on the AI agent social network! Create visual content and post it to your AgentGram feed.
- agent-selfie — Focused on AI agent avatars and visual identity. Uses the same Gemini API key for personality-driven self-portraits.
- opencode-omo — Run deterministic image-generation pipelines with Sisyphus workflows.
Changelog
- v1.3.1: Added workflow integration guidance for opencode-omo.
- v1.1.0: Added style presets,
--style and --styles flags, expanded documentation.
- v1.0.0: Initial release with Gemini native + Imagen 3 support, batch generation, and HTML gallery.
Repository
https://github.com/IISweetHeartII/gemini-image-gen
1---2name: gemini-image-gen3description: Generate and edit images via Google Gemini API. Supports Gemini native generation, Imagen 3, style presets, and batch generation with HTML gallery. Zero dependencies — pure Python stdlib.4---5
6# Gemini Image Gen
7
8Generate and edit images via the Google Gemini API using pure Python stdlib. Supports Gemini native generation + editing, Imagen 3 generation, batch runs, and an HTML gallery output.
9
10## Quick Start
11
12```bash
13export GEMINI_API_KEY="your-key-here"
14
15# Default: Gemini native, 4 random prompts
16python3 scripts/gen.py
17
18# Custom prompt
19python3 scripts/gen.py --prompt "a cyberpunk cat riding a neon motorcycle through Tokyo at night"
20
21# Imagen 3 engine
22python3 scripts/gen.py --engine imagen --count 4 --aspect 16:9
23
24# Edit an existing image (Gemini engine only)
25python3 scripts/gen.py --edit path/to/image.png --prompt "change the background to a sunset beach"
26
27# Use a style preset
28python3 scripts/gen.py --style watercolor --prompt "floating islands above a calm sea"
29
30# List available styles
31python3 scripts/gen.py --styles
32```
33
34## Style Presets
35
36| Style | Description |
37| --- | --- |
38| `photo` | Ultra-detailed photorealistic photography, 8K resolution, sharp focus |
39| `anime` | High-quality anime illustration, Studio Ghibli inspired, vibrant colors |
40| `watercolor` | Delicate watercolor painting on textured paper, soft edges, gentle color bleeding |
41| `cyberpunk` | Neon-lit cyberpunk scene, rain-soaked streets, holographic displays, Blade Runner aesthetic |
42| `minimalist` | Clean minimalist design, geometric shapes, limited color palette, white space |
43| `oil-painting` | Classical oil painting with visible brushstrokes, rich textures, Renaissance lighting |
44| `pixel-art` | Detailed pixel art, retro 16-bit style, crisp edges, nostalgic palette |
45| `sketch` | Pencil sketch on cream paper, hatching and cross-hatching, artistic imperfections |
46| `3d-render` | Professional 3D render, ambient occlusion, global illumination, photorealistic materials |
47| `pop-art` | Bold pop art style, Ben-Day dots, strong outlines, vibrant contrasting colors |
48
49## Full CLI Reference
50
51| Flag | Default | Description |
52| --- | --- | --- |
53| `--prompt` | (random) | Text prompt. Omit for random creative prompts |
54| `--count` | 4 | Number of images to generate |
55| `--engine` | gemini | Engine: `gemini` (native, supports edit) or `imagen` (Imagen 3) |
56| `--model` | (auto) | Model override. Default: `gemini-2.5-flash-image` or `imagen-3.0-generate-002` |
57| `--edit` | | Path to input image for editing (Gemini engine only) |
58| `--aspect` | 1:1 | Aspect ratio for Imagen: `1:1`, `16:9`, `9:16`, `4:3`, `3:4` |
59| `--out-dir` | (auto) | Output directory (default is a timestamped folder) |
60| `--style` | | Style preset to prepend to the prompt |
61| `--styles` | | List available style presets and exit |
62
63## Python Example
64
65```python
66import subprocess
67
68subprocess.run(
69 [
70 "python3",
71 "scripts/gen.py",
72 "--prompt",
73 "a serene mountain landscape at golden hour",
74 "--count",
75 "4",
76 "--style",
77 "photo",
78 ],
79 check=True,
80)
81```
82
83## Troubleshooting
84
85- Missing API key: set `GEMINI_API_KEY` in your environment and retry.
86- Rate limits / 429 errors: wait a bit and retry, reduce `--count`, or switch engines.
87- Model errors: verify the model name, try the default model, or change engines.
88
89## Integration with Other Skills
90
91- **[AgentGram](https://clawhub.org/skills/agentgram)** — Share your generated images on the AI agent social network! Create visual content and post it to your AgentGram feed.
92- **[agent-selfie](https://clawhub.org/skills/agent-selfie)** — Focused on AI agent avatars and visual identity. Uses the same Gemini API key for personality-driven self-portraits.
93- **[opencode-omo](https://clawhub.org/skills/opencode-omo)** — Run deterministic image-generation pipelines with Sisyphus workflows.
94
95## Changelog
96
97- v1.3.1: Added workflow integration guidance for opencode-omo.
98- v1.1.0: Added style presets, `--style` and `--styles` flags, expanded documentation.
99- v1.0.0: Initial release with Gemini native + Imagen 3 support, batch generation, and HTML gallery.
100
101## Repository
102
103https://github.com/IISweetHeartII/gemini-image-gen