ColorSep is an advanced color separation tool specifically designed for textile printing applications. It extracts different color layers from an image, allowing printers to create separate screens for each color in the printing process.
-
Multiple Color Separation Methods:
- K-means clustering: Segments the image into distinct color clusters
- Dominant color extraction: Extracts the most common colors from the image
- Color thresholding: Uses thresholds to separate colors
- LAB color space: Uses perceptual color differences for more accurate separation
-
Advanced Image Processing:
- Noise reduction
- Edge-preserving smoothing
- Sharpening
- Connected component analysis
-
Customizable Options:
- Adjust number of colors to extract
- Control color sensitivity and compactness
- Set background color
- Fine-tune post-processing parameters
-
Intuitive UI:
- Real-time preview of color layers
- Color information display (RGB, Hex, coverage percentage)
- Combined preview of all layers
- Downloadable results as individual PNGs or ZIP package
-
Advanced Layer Manipulation:
- Combine two layers into a new one
- Change colors of layers with professional color codes
- Support for Pantone TPX and TPG color systems
- Exact color extraction for pixel-perfect separation
- Control layer order and visibility for complex designs
- Preview different layer combinations with toggling options
- Clone this repository or download the files
- Install the required dependencies:
pip install -r requirements.txt
- Run the Streamlit app:
streamlit run app.py
- Upload an image using the sidebar file uploader
- Choose a color separation method and adjust parameters
- View the extracted color layers
- Use the Layer Order & Visibility Settings to:
- Change the stacking order of layers
- Toggle layer visibility on/off
- Preview different layer combinations
- Download individual layers or all layers as a zip file with order preserved
- Python 3.7+
- Streamlit
- OpenCV
- NumPy
- scikit-learn
- scikit-image
- Matplotlib
- Pillow
The application uses several advanced image processing techniques to separate colors:
- Exact Color Extraction: Creates one layer per unique color for pixel-perfect separation
- K-means Clustering: Uses unsupervised learning to group similar colors together, creating distinct clusters
- LAB Color Space: Works in a perceptually uniform color space to better match human color perception
- Connected Component Analysis: Identifies and extracts continuous regions of similar colors
- Morphological Operations: Removes noise and refines color regions
- Professional Color Systems: Supports Pantone TPX and TPG color codes used in the textile industry
This tool is particularly useful for textile printing processes that require separate screens or plates for each color, including:
- Screen printing
- Digital textile printing
- Block printing
- Transfer printing
By separating an image into color-specific layers, printers can create individual screens or plates for each color, resulting in more precise and efficient printing processes.
This project is licensed under the MIT License - see the LICENSE file for details.
- The scikit-learn team for their implementation of K-means clustering
- The OpenCV team for their comprehensive computer vision library
- The Streamlit team for their easy-to-use web application framework