https://github.com/xaheli/spectrums
Spectrums: Optimize GMM params, UI, export palettes, improve clustering accuracy, and add customizable color schemes.
https://github.com/xaheli/spectrums
cluster-analysis color-palette colors gaussian gaussian-mixture-models imageclassifier palette-colors
Last synced: about 1 year ago
JSON representation
Spectrums: Optimize GMM params, UI, export palettes, improve clustering accuracy, and add customizable color schemes.
- Host: GitHub
- URL: https://github.com/xaheli/spectrums
- Owner: XAheli
- License: apache-2.0
- Created: 2023-09-21T14:52:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-21T15:31:20.000Z (over 2 years ago)
- Last Synced: 2025-01-22T10:36:06.674Z (over 1 year ago)
- Topics: cluster-analysis, color-palette, colors, gaussian, gaussian-mixture-models, imageclassifier, palette-colors
- Language: Jupyter Notebook
- Homepage:
- Size: 5.75 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spectrums - Color Palette Generator
## Introduction
Spectrums is a Python utility that allows you to create beautiful color palettes based on an input image. This project was created as a practice exercise to gain a deeper understanding of Gaussian Mixture Models (GMMs) and color analysis. It uses GMMs to cluster colors from an image and presents them in a visually appealing palette.

## Features
- Generate color palettes from input images.
- Utilizes Gaussian Mixture Models (GMMs) for color clustering.
- Sorts colors based on a custom ranking that considers hue, saturation, and perceived brightness.
- Provides a graphical representation of the generated color palette.
..jpg)
## Prerequisites
- Python 3.9
- Required Python libraries: `numpy`, `scikit-learn`, `Pillow`, `matplotlib`
## Installation
1. Clone this repository to your local machine:
```bash
git clone https://github.com/XAheli/spectrums.git
cd spectrums
## Usage
- Ensure you have an image (e.g., IMG_1969 copy.jpg) that you want to create a color palette from. You can replace this file with your own image.
- Open the spectrums.py script in a text editor and modify the image_path variable to specify the path to your image.
- Adjust the num_colors variable to set the number of colors you want in the palette.
- Run the script:
```bash
python spectrums.py
- The script will generate a graphical representation of the color palette and display it using Matplotlib. You can adjust the figure size and layout in the script as needed.
- The script will also print the color labels and their RGB values to the console.
## Customization
- You can customize the script further by adjusting the coefficients in the perceived_brightness function to change how brightness is calculated.
- Modify the ranking in the hsp_rank function to influence the sorting of colors based on your preferences.
## License
This project is licensed under the [Apache License 2.0](LICENSE) - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- The custom color ranking algorithm in this project is inspired by the work of Darel Rex Finley ([source](http://alienryderflex.com/hsp.html)).
Enjoy creating beautiful color palettes with Spectrums! If you find this project useful, don't forget to give it a star ⭐!