Command Line Interface¶
Overview
modern_colorthief ships with a built-in command-line interface
invoked via the modern-colorthief command.
Usage
modern-colorthief [OPTIONS] FILE
Arguments
- FILE
Path to the image file to analyze.
Options
- --palette
Extract a palette of dominant colors instead of a single color.
- --quality
Quality setting (default:
10). Higher values are faster but less accurate. Valid range is1to100.
- --count
Number of colors in the palette (default:
5). Only used with--palette.
Examples
Get the dominant color:
$ modern-colorthief path/to/image.png
# Output: #f0e68c
Get a color palette:
$ modern-colorthief path/to/image.png --palette
# Output:
# #f0e68c
# #556b2f
# ...
Custom quality and count:
$ modern-colorthief photo.jpg --palette --quality 5 --count 8
# Output: 8 colors with higher accuracy
Tip
Use a lower --quality value (e.g., 1) for the most accurate
results when processing images where color precision matters.
See also
API Reference – The CLI wraps the same functions as the Python API.