原文
Convert text prompts to pen-plotter-ready SVG files using AI image generation and centerline vectorization.
- Prompt Enhancement - LLM rewrites your prompt for optimal line art generation
- Raster Generation - Flux.2-dev generates a high-contrast line art image
- Vectorization - Skeletonization and graph extraction produce clean paths
- Optimization - Paths are merged, simplified, and sorted for efficient plotting
- Output - Plotter-ready SVG with configurable dimensions
- Python 3.10+
- NVIDIA GPU with 24GB VRAM (RTX 3090/4090)
- CUDA 12.x
- OpenRouter API key for prompt enhancement
- HuggingFace token with access to Flux.2-dev
git clone https://github.com/malvarezcastillo/txt2plotter.git
cd txt2plotter
# Create virtual environment
python3.10 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -e .
# Configure API keys
cp .env.example .env
# Edit .env with your keys# Basic usage (A3 size)
python main.py "a geometric skull"
# Custom dimensions (A4)
python main.py "circuit board pattern" --width 297 --height 210
# Generate multiple variations
python main.py "mountain landscape" -n 5
# Reproducible generation with seed
python main.py "geometric pattern" --seed 42
# Generate 3 reproducible variations (uses seed, seed+1, seed+2)
python main.py "geometric pattern" -n 3 --seed 42
# Skip prompt enhancement
python main.py "minimalistic line drawing of a cat" --skip-enhance
# Batch mode: process multiple prompts from file
python main.py --batch prompts.txt -n 10Create a prompts.txt file (one prompt per line, supports comments):
# My prompts
"Minimalistic isometric impossible cube, thick black lines, technical drawing."
"Single continuous line drawing of a greyhound, Picasso style."
# This is also valid (no quotes)
A geometric skull with clean vector lines
Output is organized by prompt: output/<prompt_slug>/
output/*.svg- Final plotter-ready SVGsoutput/debug/- Intermediate files for debugging:01_prompt_enhanced.txt- Enhanced prompt02_raster_raw.png- Generated image02_raster_binary.png- Thresholded binary03_skeleton.png- Skeletonized paths03_graph_*.png- Graph visualization03_paths.svg- Raw paths04_optimized.svg- After optimization
MIT

