Skip to content

Repository files navigation

🧵 DMC Thread Color Analyzer

A Streamlit application that analyzes embroidery images and recommends the closest DMC thread colors needed for your project.

Features

  • 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

Installation

  1. Clone or navigate to this directory

  2. Install dependencies

    pip install -r requirements.txt

Usage

  1. Run the application

    streamlit run app.py
  2. Open your browser - Streamlit will automatically open at http://localhost:8501

  3. Upload an image - Click "Browse files" and select your embroidery image

  4. Review suggestion - The app automatically suggests the optimal number of colors

  5. Adjust settings (optional)

    • Use the suggested number or adjust manually (3-40 colors)
    • DMC matches per color (1-5)
  6. View results

    • See the extracted colors
    • Review DMC thread recommendations
    • Download PDF with original image and color grid
    • Or download as simple text list

How It Works

  1. Image Analysis: The app analyzes your image complexity using the elbow method to suggest optimal color count
  2. Color Extraction: Uses K-means clustering to identify the most dominant colors in your image
  3. LAB Conversion: Colors are converted to LAB color space, which is perceptually uniform
  4. Color Matching: Each extracted color is compared against a database of 489 DMC thread colors using Delta E (CIEDE2000)
  5. Quality Filtering: Poor matches (Delta E > 50) are filtered out to show only relevant suggestions
  6. Results: Shows the best matching DMC threads with quality ratings based on Delta E scores

Delta E Quality Guide

  • Δ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)

DMC Color Database

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)

Tips for Best Results

  • 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

Project Structure

dmc-thread/
├── app.py              # Main Streamlit application
├── dmc_colors.py       # DMC color database
├── requirements.txt    # Python dependencies
└── README.md          # This file

Technologies Used

  • 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

License

This project is for personal use. DMC is a registered trademark of DMC Corporation.

Contributing

Feel free to fork this project and add your own enhancements!

About

A Streamlit application that analyzes embroidery images and recommends the closest DMC thread colors needed for your project.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages