File size: 7,273 Bytes
cbec570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
license: cc-by-4.0
task_categories:
  - text-to-image
  - image-to-image
tags:
  - comic-generation
  - sdxl
  - qwen
  - local-ai
  - pillow
  - comfyui
  - pipeline
  - ai-comic
  - public-domain
pretty_name: "GritAI Comic Pipeline - AI-Generated Classic Literature Comics"
size_categories:
  - n<1K
---

# GritAI Comic Pipeline

**One person. Local hardware. 13 complete AI-generated comics in a single day.**

A fully local, reproducible pipeline that transforms story descriptions into complete multi-page comic books with panel layouts, character consistency, and dialogue overlays. Zero cloud APIs. Zero subscriptions. Just SDXL + Qwen + Pillow + PowerShell.

## Pipeline Architecture

```
Story JSON → Stage 1 (SDXL Base) → Stage 2 (Qwen Edit) → Stage 3 (Pillow Assembly) → Bubble Renderer → PDF
```

### Stage 1: SDXL Single Base Generation
- Checkpoint: `realcartoonXL_v7` (RealCartoonXL)
- Single base image per page using character-consistent prompt
- Same `base_seed` across all pages for character consistency
- 20 steps, CFG 7, 1024x1536 portrait

### Stage 2: Qwen Parallel Panel Editing
- Model: Qwen 2.5 VL (image editing mode)
- Takes single base image → branches into N unique panels simultaneously
- Each panel gets a unique `edit_prompt` describing the scene
- 4 steps, CFG 1 (fast inference)
- All panels generated in parallel via ComfyUI API

### Stage 3: Pillow Panel Assembly
- Custom Python/Pillow assembler (replaced ComfyUI CR Comic Panel Templates)
- 12 layout templates: H2, H3, V2, V3, G22, G33, H12, H21, H13, H31, V12, V21
- Auto-scale and center-crop panels to fill slots exactly
- 8px black borders between panels
- Assembly time: ~1 second per page (down from 6s with CR node)

### Stage 4: Bubble Renderer
- Overlays narration boxes, speech bubbles, and thought bubbles
- Reads `text` arrays from story JSON
- Position-aware: places bubbles within correct panel boundaries
- Three types: narration (rectangular, cream), speech (rounded, white, tail), thought (cloud, dots)
- Comic font rendering with word wrap

### Orchestration
- `run_story.ps1` — One-command story generation from JSON
- `run_comic_pipeline.ps1` — Per-page pipeline execution via ComfyUI API
- `pillow_assembler.py` — Panel assembly with layout templates
- `bubble_renderer.py` — Dialogue overlay system
- Auto-titling with arched gold text
- Auto-PDF generation

## Hardware

| Node | Specs | Role |
|------|-------|------|
| Rig1 | RTX 5070 Ti + RTX 3060, Windows | SDXL generation, ComfyUI, dataset staging |
| Spark-2693 | NVIDIA DGX Spark, Blackwell, 128GB unified, Linux | Robotics, local LLM inference (future) |

## Output Stats

**Produced in a single session:**

| Metric | Value |
|--------|-------|
| Total stories | 13 |
| Total pages | 80+ |
| Total panels | 230+ |
| Layout templates used | 6 (H2, H3, V2, G22, H12, H21) |
| Avg time per page | ~1.5 min |
| Avg time per 8-page story | ~14 min |
| Stories with dialogue | 3 (WotW, Frankenstein, Dracula) |

## Stories

All source material is public domain classic literature.

| # | Title | Pages | Panels | Template Mix |
|---|-------|-------|--------|-------------|
| 1 | War of the Worlds - Vol. 1 | 4 | 16 | G22 |
| 2 | War of the Worlds - Complete | 8 | 23 | H2, H21, G22, H3, V2, H12 |
| 3 | Frankenstein | 8 | 23 | H2, H21, G22, H3, V2, H12 |
| 4 | Dracula | 8 | 23 | H2, H21, G22, V2, H3, H12 |
| 5 | The Time Machine | 8 | 23 | H2, H21, G22, H3, V2, H12 |
| 6 | Jekyll and Hyde | 7 | 19 | H2, H21, G22, H3, V2, H12 |
| 7 | 20,000 Leagues Under the Sea | 8 | 23 | H2, H21, G22, H3, V2, H12 |
| 8 | Treasure Island | 5 | 15 | H2, H21, G22, H3 |
| 9 | The Invisible Man | 5 | 15 | H2, H21, G22, H3 |
| 10 | A Christmas Carol | 6 | 17 | H2, H21, G22, H3, V2 |
| 11 | Hound of the Baskervilles | 4 | 12 | H2, H21, G22 |
| 12 | The Picture of Dorian Gray | 4 | 12 | H2, G22, H3 |
| 13 | Journey to the Center of the Earth | 5 | 15 | H2, H21, G22, V2 |
| 14 | The Island of Doctor Moreau | 5 | 15 | H2, H21, G22, H3 |

## Story JSON Format

Each story is defined as a single JSON file:

```json
{
    "story_id": "frankenstein",
    "story_title": "FRANKENSTEIN",
    "base_prompt": "character description for consistency across pages",
    "base_seed": 8001,
    "global_settings": {
        "width": 1024, "height": 1536,
        "stage1_steps": 20, "stage1_cfg": 7,
        "stage2_steps": 4, "stage2_cfg": 1,
        "sdxl_checkpoint": "SDXL\\realcartoonXL_v7.safetensors"
    },
    "pages": [
        {
            "page_title": "THE CREATION",
            "page_template": "H21",
            "panels": [
                {
                    "panel_id": 1,
                    "seed": 8201,
                    "edit_prompt": "scene description for this panel",
                    "text": [
                        {"type": "narration", "position": "top", "content": "The storm answered my ambition."},
                        {"type": "speech", "position": "bottom-left", "content": "LIVE! In the name of God -- LIVE!"}
                    ]
                }
            ]
        }
    ]
}
```

## Layout Templates

```
H2:  [████████]    H3:  [████████]    V2: [████|████]    G22: [████|████]
     [████████]         [████████]        [████|████]         [████|████]
                        [████████]

H12: [████████]    H21: [████|████]    H13: [████████████]
     [████|████]        [████████████]       [████|████|████]
```

## Samples

### War of the Worlds - Complete Edition (with dialogue)
![WotW Page 1](samples/wotw_01.png)
![WotW Page 3](samples/wotw_03.png)

### Frankenstein (with dialogue)
![Frank Page 2](samples/frank_02.png)
![Frank Page 5](samples/frank_05.png)

### Dracula (with dialogue)
![Drac Page 2](samples/drac_02.png)
![Drac Page 6](samples/drac_06.png)

## Covers
![Covers](covers/)

## Key Technical Decisions

1. **Single base → parallel edit** — Generating one base per page and editing it into multiple panels preserves character consistency far better than generating each panel independently.

2. **Pillow over ComfyUI for assembly** — CR Comic Panel Templates couldn't scale panels to fill non-G22 layouts. Custom Pillow assembler handles all 12 templates with center-crop fill. Reduced assembly from 6s to 1s.

3. **PowerShell orchestration** — ComfyUI API called via PowerShell, not Python. Enables Windows-native workflow with direct filesystem access.

4. **Bubble renderer as post-process** — Text overlays happen AFTER page assembly, reading from the same JSON. No re-rendering needed to add/edit dialogue.

## License

Pipeline outputs are CC-BY-4.0. Source stories are public domain.

## Built by

**GritAI** — A one-person AI lab focused on reproducible AI generation, local deployment, and proving that meaningful creative output doesn't require cloud subscriptions or enterprise budgets.

- X: [@BonusLockSmith](https://x.com/BonusLockSmith)
- Gumroad: [gritai.gumroad.com](https://gritai.gumroad.com)
- Reppo: [reppo.ai](https://reppo.ai)