A Streamlit application that analyzes embroidery images and recommends the closest DMC thread colors needed for your project.
- Image Upload - Support for PNG, JPG, JPEG, WebP, and BMP formats
- Smart Color Detection - Automatically suggests optimal number of colors using elbow method
- Color Extraction - Uses K-means clustering to identify dominant colors (3-40 colors)
- Advanced Color Matching - LAB color space (CIEDE2000) for perceptually accurate matching
- Quality Ratings - Delta E scores show match quality (Excellent, Very Good, Good, Fair, Approximate)
- Extensive Database - 489 DMC thread colors with accurate RGB values from maxxmint.com
- Visual Results - See extracted colors alongside their DMC matches
- Shopping List - Copyable color swatches (right-click to copy images) in list or grid view
- PDF Export - Download a beautiful PDF with original image and color grid
- Text Export - Download shopping list as simple text file
- Customizable - Adjust the number of colors to extract (up to 40) and matches per color
-
Clone or navigate to this directory
-
Install dependencies
pip install -r requirements.txt
-
Run the application
streamlit run app.py
-
Open your browser - Streamlit will automatically open at
http://localhost:8501 -
Upload an image - Click "Browse files" and select your embroidery image
-
Review suggestion - The app automatically suggests the optimal number of colors
-
Adjust settings (optional)
- Use the suggested number or adjust manually (3-40 colors)
- DMC matches per color (1-5)
-
View results
- See the extracted colors
- Review DMC thread recommendations
- Download PDF with original image and color grid
- Or download as simple text list
- Image Analysis: The app analyzes your image complexity using the elbow method to suggest optimal color count
- Color Extraction: Uses K-means clustering to identify the most dominant colors in your image
- LAB Conversion: Colors are converted to LAB color space, which is perceptually uniform
- Color Matching: Each extracted color is compared against a database of 489 DMC thread colors using Delta E (CIEDE2000)
- Quality Filtering: Poor matches (Delta E > 50) are filtered out to show only relevant suggestions
- Results: Shows the best matching DMC threads with quality ratings based on Delta E scores
- ΔE < 2: Excellent match (imperceptible difference)
- ΔE 2-5: Very Good match (very close)
- ΔE 5-10: Good match (close enough for most projects)
- ΔE 10-20: Fair match (noticeable but acceptable)
- ΔE > 20: Approximate match (consider alternatives)
The application includes a comprehensive database of DMC embroidery floss colors including:
- Thread number
- Color name
- RGB values
Currently includes 489 DMC colors with accurate RGB values sourced from maxxmint.com across all color families:
- Reds, Pinks, Roses
- Oranges, Corals, Peaches
- Yellows, Golds
- Greens (Forest, Jade, Pistachio, Avocado, Parrot, Nile)
- Blues (Sky, Cornflower, Delft, Royal, Navy, Denim, Peacock, Electric)
- Teals, Turquoise, Aquamarine
- Purples, Violets, Lavenders, Plums, Mauves
- Browns, Tans, Beiges
- Grays, Blacks, Whites
- Metallics (Gold, Silver, Copper)
- Use clear, well-lit images
- Images with distinct colors work best
- Crop to focus on the embroidery area
- Higher resolution images provide better color accuracy
dmc-thread/
├── app.py # Main Streamlit application
├── dmc_colors.py # DMC color database
├── requirements.txt # Python dependencies
└── README.md # This file
- Streamlit - Web application framework
- Pillow (PIL) - Image processing
- NumPy - Numerical operations
- scikit-learn - K-means clustering for color extraction
- scikit-image - LAB color space conversion for perceptually accurate matching
- ReportLab - PDF generation with color swatches
This project is for personal use. DMC is a registered trademark of DMC Corporation.
Feel free to fork this project and add your own enhancements!