https://github.com/aurcode/sunglass-cli
Convert an image to a given color palette using Python. This script allows you to transform images by mapping their colors to a specified palette. The color distance is calculated using the CIEDE2000 algorithm.
https://github.com/aurcode/sunglass-cli
ciede2000 image-processing
Last synced: 5 months ago
JSON representation
Convert an image to a given color palette using Python. This script allows you to transform images by mapping their colors to a specified palette. The color distance is calculated using the CIEDE2000 algorithm.
- Host: GitHub
- URL: https://github.com/aurcode/sunglass-cli
- Owner: aurcode
- Created: 2025-01-22T13:22:36.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-24T14:16:17.000Z (about 1 year ago)
- Last Synced: 2025-04-02T10:39:38.552Z (12 months ago)
- Topics: ciede2000, image-processing
- Language: Python
- Homepage:
- Size: 203 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sunglass-cli
## Image Color Palette Converter
This Python script converts an input image to a specified color palette. The script utilizes the CIEDE2000 color difference algorithm to find the closest matching colors in the given palette.
### Usage:
1. Install the required Python libraries:
```
docker run --rm -it --name python -v .:/src python:3.10 bash
pip install pillow==10.0.1 colormath==3.0.0 numpy==1.22.0
```
2. Run the script with the following command-line arguments:
```
python image_color_converter.py input_image_path output_image_path --palette color1 color2 color3 ...
```
- `input_image_path`: Path to the input image.
- `output_image_path`: Path to save the output image.
- `--palette`: List of hex colors to use in the output image (optional).
### Example:
```
python /src/sunglass.py input.jpg output.jpg --palette ffffff 999999 555555 222222
python /src/sunglass.py /src/res/input.jpg /src/res/output.jpg
```
### Results:


Feel free to contribute, report issues, or suggest improvements!