# Quick Start Guide ## Installation ```bash pip install -r requirements.txt ``` ## Basic Usage ### Extract layers from PDF ```bash python layer_extractor.py diagram.pdf ``` That's it! Layers will be saved to `output/` directory. ## Common Adjustments ### Problem: Colors bleeding between layers ```bash # INCREASE tolerance (counter-intuitive but correct!) # Antialiasing creates intermediate colors that need higher tolerance python layer_extractor.py diagram.pdf -t 45 ``` ### Problem: Layers mixing too much ```bash # Decrease tolerance (stricter color matching) python layer_extractor.py diagram.pdf -t 20 ``` ### Problem: Missing fine details ```bash # Increase tolerance + higher DPI python layer_extractor.py diagram.pdf -t 40 --dpi 600 ``` ### Problem: Too many layers detected ```bash # Increase minimum pixel threshold python layer_extractor.py diagram.pdf -m 500 ``` ### Problem: Need exact number of layers ```bash # Specify layer count (extracts top N by frequency) python layer_extractor.py diagram.pdf -n 4 ``` ### Problem: Low quality output ```bash # Render at higher DPI python layer_extractor.py diagram.pdf --dpi 600 ``` ## Output Files Files are saved as: ``` output/diagram_layer1_220_050_050.png (Red layer) output/diagram_layer2_050_100_220.png (Blue layer) output/diagram_layer3_050_180_050.png (Green layer) ``` The numbers in filename are RGB values of the layer color. ## Typical Workflows ### Standard diagram (moderate antialiasing) ```bash python layer_extractor.py diagram.pdf # Use defaults - works for most cases ``` ### High-detail mechanical drawing ```bash python layer_extractor.py drawing.pdf --dpi 600 -t 25 # Higher resolution, tighter tolerance ``` ### Scanned/compressed diagram ```bash python layer_extractor.py scanned.pdf -t 45 # More lenient to handle artifacts ``` ### Known layer count ```bash python layer_extractor.py diagram.pdf -n 3 # Faster if you know there are 3 layers ``` ## Parameters Quick Reference - `--dpi` - Resolution (default 300) - 150 = draft - 300 = standard - 600 = high quality - `-t` - Tolerance (default 30, scale 0-100) - 15-20 = strict - 30 = balanced (RECOMMENDED) - 45-60 = lenient (for antialiasing) - `-n` - Number of layers (default auto-detect) - `-o` - Output directory (default "output") ## Getting Help ```bash python layer_extractor.py --help ```