BubbleCoding/CandlekeepComicbooks

Python

0

20 commits

updated Mar 7, 2026

See the code

README

Candlekeep Comicbooks

An automated pipeline that converts TTRPG (Tabletop Role-Playing Game) audio recordings into illustrated comic books. This project uses AI for transcription, script generation, image generation, and layout to create a visual retelling of your D&D sessions.

Master's Thesis Project

๐ŸŽฏ Features

  • Audio Transcription - Converts session recordings to text with speaker diarization
  • Script Generation - Transforms transcripts into structured comic panels using LLMs
  • Prompt Engineering - Generates optimized SDXL prompts for each panel
  • Image Generation - Creates fantasy art using Stable Diffusion XL with LoRA weights
  • Text Overlay - Adds dialogue to generated images
  • Page Layout - Arranges panels into comic book pages (2x3 grid)
  • PDF Export - Combines all pages into a final PDF comic book

๐Ÿ“‹ Requirements

  • Python 3.10+
  • CUDA-compatible GPU (for image generation)
  • NVIDIA GPU with 12GB+ VRAM recommended
  • HuggingFace account (for pyannote diarization)
  • Ollama with llama3.1 model installed

๐Ÿš€ Installation

1. Clone the repository

git clone https://github.com/BubbleCoding/CandlekeepComicbooks.git
cd CandlekeepComicbooks

2. Create virtual environment

python -m venv env
# Windows
env\Scripts\activate
# Linux/Mac
source env/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Download LoRA weights

Download the required LoRA weights (if desired) and place them in assets/lora/:

  • Fantasy_art_XL_V1.safetensors (~435 MB) - Primary LoRA for fantasy art
  • Download from CivitAI or HuggingFace

See assets/lora/README.md for more details.

5. Install Ollama

Download and install Ollama, then pull the llama3.1 model:

ollama pull llama3.1

6. Setup HuggingFace token

For speaker diarization, you need a HuggingFace token with access to pyannote models:

  1. Create account at HuggingFace
  2. Accept the terms for pyannote/speaker-diarization-3.1
  3. Set your token as environment variable:
# Windows PowerShell
$env:HF_TOKEN = "your_token_here"
# Linux/Mac
export HF_TOKEN="your_token_here"

7. Add your audio file

Place your TTRPG session recording in the audio/ directory as a .wav file.

๐Ÿ“ Project Structure

CandlekeepComicbooks/
โ”œโ”€โ”€ main.py                      # Main pipeline runner
โ”œโ”€โ”€ requirements.txt             # Python dependencies
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ fonts/
โ”‚   โ”‚   โ””โ”€โ”€ manga-temple.ttf    # Font for text overlays
โ”‚   โ””โ”€โ”€ lora/
โ”‚       โ””โ”€โ”€ *.safetensors       # LoRA weights (not in repo)
โ”œโ”€โ”€ audio/                       # Place your .wav files here
โ”œโ”€โ”€ output/                      # Generated outputs (gitignored)
โ”‚   โ”œโ”€โ”€ *.json                  # Intermediate script files
โ”‚   โ”œโ”€โ”€ images/
โ”‚   โ”‚   โ”œโ”€โ”€ imagesWithText/     # Final panel images
โ”‚   โ”‚   โ””โ”€โ”€ imagesWithoutText/  # Raw generated images
โ”‚   โ”œโ”€โ”€ comicPages/             # Combined page layouts
โ”‚   โ””โ”€โ”€ comic.pdf               # Final output
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ transcribe.py           # Audio โ†’ Text with speakers
    โ”œโ”€โ”€ generate_script.py      # Text โ†’ Comic script
    โ”œโ”€โ”€ generate_prompts.py     # Script โ†’ SDXL prompts
    โ”œโ”€โ”€ generate_images.py      # Prompts โ†’ Images
    โ”œโ”€โ”€ AddTextToImage.py       # Add dialogue to images
    โ”œโ”€โ”€ CreateComicPage.py      # Combine panels into pages
    โ””โ”€โ”€ pdfMerger.py           # Pages โ†’ PDF

๐ŸŽฎ Usage

Run the complete pipeline:

python main.py

This will execute all 6 steps:

  1. Transcribe audio โ†’ output/clean_transcript_with_speakers.json
  2. Generate comic script โ†’ output/adaptive_comic_script.json
  3. Generate SDXL prompts โ†’ output/adaptive_comic_script_with_prompts.json
  4. Generate panel images โ†’ output/images/
  5. Create comic pages โ†’ output/comicPages/
  6. Merge into PDF โ†’ output/comic.pdf

Run individual steps:

# Just transcription
python -m src.transcribe

# Just image generation (requires existing script)
python -m src.generate_images

โš™๏ธ Configuration

Modify generation settings:

  • Audio file: Edit path in src/transcribe.py (line 165)
  • Chunk size: Adjust in src/generate_script.py (chunk_size parameter)
  • LoRA model: Change in src/generate_images.py (line 21)
  • Page layout: Modify columns, rows in src/CreateComicPage.py (line 29)
  • Image quality: Adjust negative prompts in src/generate_prompts.py (line 66)

๐Ÿงช Testing Mode

Enable testing mode in src/generate_images.py to generate only 6 panels:

testing = True  # Line 6

๐Ÿ“ Notes

  • First run will download SDXL model (~7GB) and other models
  • Image generation is the slowest step (~30-60 seconds per panel)
  • GPU memory usage peaks at ~10GB during image generation
  • Average session (1 hour audio) produces 20-40 panels

๐Ÿ› Troubleshooting

Out of memory errors: Reduce batch size or use smaller models Diarization fails: Check HuggingFace token and model access Missing font errors: Ensure manga-temple.ttf is in assets/fonts/ Import errors: Make sure you're running from project root directory

๐Ÿ“„ License

See LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Stable Diffusion XL by Stability AI
  • Whisper by OpenAI
  • pyannote for speaker diarization
  • Ollama for local LLM inference

๐Ÿ“ง Contact

Master's Thesis Project - Feel free to open issues or contribute!

BubbleCoding/CandlekeepComicbooks

Python

0

20 commits

updated Mar 7, 2026

See the code

README

Candlekeep Comicbooks

An automated pipeline that converts TTRPG (Tabletop Role-Playing Game) audio recordings into illustrated comic books. This project uses AI for transcription, script generation, image generation, and layout to create a visual retelling of your D&D sessions.

Master's Thesis Project

๐ŸŽฏ Features

  • Audio Transcription - Converts session recordings to text with speaker diarization
  • Script Generation - Transforms transcripts into structured comic panels using LLMs
  • Prompt Engineering - Generates optimized SDXL prompts for each panel
  • Image Generation - Creates fantasy art using Stable Diffusion XL with LoRA weights
  • Text Overlay - Adds dialogue to generated images
  • Page Layout - Arranges panels into comic book pages (2x3 grid)
  • PDF Export - Combines all pages into a final PDF comic book

๐Ÿ“‹ Requirements

  • Python 3.10+
  • CUDA-compatible GPU (for image generation)
  • NVIDIA GPU with 12GB+ VRAM recommended
  • HuggingFace account (for pyannote diarization)
  • Ollama with llama3.1 model installed

๐Ÿš€ Installation

1. Clone the repository

git clone https://github.com/BubbleCoding/CandlekeepComicbooks.git
cd CandlekeepComicbooks

2. Create virtual environment

python -m venv env
# Windows
env\Scripts\activate
# Linux/Mac
source env/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Download LoRA weights

Download the required LoRA weights (if desired) and place them in assets/lora/:

  • Fantasy_art_XL_V1.safetensors (~435 MB) - Primary LoRA for fantasy art
  • Download from CivitAI or HuggingFace

See assets/lora/README.md for more details.

5. Install Ollama

Download and install Ollama, then pull the llama3.1 model:

ollama pull llama3.1

6. Setup HuggingFace token

For speaker diarization, you need a HuggingFace token with access to pyannote models:

  1. Create account at HuggingFace
  2. Accept the terms for pyannote/speaker-diarization-3.1
  3. Set your token as environment variable:
# Windows PowerShell
$env:HF_TOKEN = "your_token_here"
# Linux/Mac
export HF_TOKEN="your_token_here"

7. Add your audio file

Place your TTRPG session recording in the audio/ directory as a .wav file.

๐Ÿ“ Project Structure

CandlekeepComicbooks/
โ”œโ”€โ”€ main.py                      # Main pipeline runner
โ”œโ”€โ”€ requirements.txt             # Python dependencies
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ fonts/
โ”‚   โ”‚   โ””โ”€โ”€ manga-temple.ttf    # Font for text overlays
โ”‚   โ””โ”€โ”€ lora/
โ”‚       โ””โ”€โ”€ *.safetensors       # LoRA weights (not in repo)
โ”œโ”€โ”€ audio/                       # Place your .wav files here
โ”œโ”€โ”€ output/                      # Generated outputs (gitignored)
โ”‚   โ”œโ”€โ”€ *.json                  # Intermediate script files
โ”‚   โ”œโ”€โ”€ images/
โ”‚   โ”‚   โ”œโ”€โ”€ imagesWithText/     # Final panel images
โ”‚   โ”‚   โ””โ”€โ”€ imagesWithoutText/  # Raw generated images
โ”‚   โ”œโ”€โ”€ comicPages/             # Combined page layouts
โ”‚   โ””โ”€โ”€ comic.pdf               # Final output
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ transcribe.py           # Audio โ†’ Text with speakers
    โ”œโ”€โ”€ generate_script.py      # Text โ†’ Comic script
    โ”œโ”€โ”€ generate_prompts.py     # Script โ†’ SDXL prompts
    โ”œโ”€โ”€ generate_images.py      # Prompts โ†’ Images
    โ”œโ”€โ”€ AddTextToImage.py       # Add dialogue to images
    โ”œโ”€โ”€ CreateComicPage.py      # Combine panels into pages
    โ””โ”€โ”€ pdfMerger.py           # Pages โ†’ PDF

๐ŸŽฎ Usage

Run the complete pipeline:

python main.py

This will execute all 6 steps:

  1. Transcribe audio โ†’ output/clean_transcript_with_speakers.json
  2. Generate comic script โ†’ output/adaptive_comic_script.json
  3. Generate SDXL prompts โ†’ output/adaptive_comic_script_with_prompts.json
  4. Generate panel images โ†’ output/images/
  5. Create comic pages โ†’ output/comicPages/
  6. Merge into PDF โ†’ output/comic.pdf

Run individual steps:

# Just transcription
python -m src.transcribe

# Just image generation (requires existing script)
python -m src.generate_images

โš™๏ธ Configuration

Modify generation settings:

  • Audio file: Edit path in src/transcribe.py (line 165)
  • Chunk size: Adjust in src/generate_script.py (chunk_size parameter)
  • LoRA model: Change in src/generate_images.py (line 21)
  • Page layout: Modify columns, rows in src/CreateComicPage.py (line 29)
  • Image quality: Adjust negative prompts in src/generate_prompts.py (line 66)

๐Ÿงช Testing Mode

Enable testing mode in src/generate_images.py to generate only 6 panels:

testing = True  # Line 6

๐Ÿ“ Notes

  • First run will download SDXL model (~7GB) and other models
  • Image generation is the slowest step (~30-60 seconds per panel)
  • GPU memory usage peaks at ~10GB during image generation
  • Average session (1 hour audio) produces 20-40 panels

๐Ÿ› Troubleshooting

Out of memory errors: Reduce batch size or use smaller models Diarization fails: Check HuggingFace token and model access Missing font errors: Ensure manga-temple.ttf is in assets/fonts/ Import errors: Make sure you're running from project root directory

๐Ÿ“„ License

See LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Stable Diffusion XL by Stability AI
  • Whisper by OpenAI
  • pyannote for speaker diarization
  • Ollama for local LLM inference

๐Ÿ“ง Contact

Master's Thesis Project - Feel free to open issues or contribute!