1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# ComicForge

ComicForge turns a vocabulary file into a generated comic package. It uses Gemini-backed providers to write a story, draw comic pages, and optionally produce narration. The CLI writes the finished assets into `./comics/<slug>/` and can also assemble a PDF.
## What It Does
ComicForge reads a vocabulary list, generates a story from those words, renders comic pages, and saves supporting files alongside the comic. By default it uses Gemini for text, image, and text-to-speech generation.
Generated output includes:
- story text
- vocabulary recap
- theme file
- comic page PNGs
- PDF output when page rendering succeeds
- narration MP3 when narration is enabled and a TTS provider is available
## Installation
Build and test with Mage:
```bash
mage build
mage test
mage install
```
Or build directly:
```bash
go build -o comicforge ./cmd/comicforge
```
The `mage install` target copies the binary into `$GOPATH/bin` and falls back to `~/go/bin` when `GOPATH` is not set.
## Configuration
ComicForge loads configuration from:
1. `--config <file>` when provided
2. `~/.config/comicforge/config.yaml`
3. `~/config.yaml`
4. `./config.yaml`
Environment variables also work. `COMICFORGE_` is the prefix, and dots in config keys become underscores. Examples:
- `COMICFORGE_API_GOOGLE_API_KEY`
- `COMICFORGE_PROVIDER_TEXT`
- `COMICFORGE_MODELS_IMAGE`
- `COMICFORGE_COMIC_STORY_PAGES`
Start from [`config.yaml.example`](config.yaml.example). The important settings are:
```yaml
provider:
text: gemini
image: gemini
tts: gemini
api:
google_api_key: ""
models:
text: gemini-2.5-flash
image: gemini-3.1-flash-image-preview
image_text: gemini-2.5-flash
tts: gemini-2.5-flash-preview-tts
comic:
story_pages: 5
gallery_pages: 5
panels_per_page: 4
aspect_ratio: "16:9"
prompt_max_chars: 900
page_max_retries: 5
page_retry_base_seconds: 15
story:
realistic_weight: 0.4
styles:
comic:
- classic comic book with bold ink outlines
- graphic novel with dramatic shadows
realistic:
- ultra-realistic DSLR photography, cinematic 35mm lens
- cinematic realism with natural light
narration:
chunk_words: 100
prompts_dir: ./prompts
```
`provider.*` currently supports Gemini in this codebase. Set `api.google_api_key` or `COMICFORGE_API_GOOGLE_API_KEY` for Gemini-backed generation.
## Usage
ComicForge requires a vocabulary file:
```bash
comicforge --vocab words.txt --config config.yaml --output out
```
Vocabulary lines can be:
- `ябълка = apple`
- `котка == домашно животно`
- `стол`
- `= translation only`
Useful flags:
- `--output` sets the root output directory
- `--prompts-dir` overrides the prompt template directory
- `--style` and `--theme` override story generation hints
- `--slug` forces the output folder name
- `--narrate` enables narration output
- `--narrator-voice` picks the Gemini narration voice
- `--text-provider`, `--image-provider`, `--tts-provider` override provider names
- `--text-model`, `--image-model`, `--image-text-model`, `--tts-model` override model IDs
- `--ultra-realistic` and `--no-ultra-realistic` control the rendering mode
- `--version` prints the application version
Example:
```bash
comicforge \
--vocab vocab.txt \
--config config.yaml \
--output out \
--slug demo-comic \
--narrate
```
The generated files are written under `out/comics/demo-comic/`.
|