A fast command-line image color quantizer written in Rust. Extract the dominant colors from an image and display them in your preferred color format, rendered with inline terminal color swatches.
Requires Rust (edition 2024 / Rust 1.85+).
git clone https://github.com/CORVUS047/imq
cd imq
cargo build --releaseThe binary will be at target/release/imq. Optionally, install it to your PATH:
cargo install --path .imq --image <PATH> --color-format <FORMAT> [--quant <N>] [--visible-swath]| Flag | Short | Description | Default |
|---|---|---|---|
--image |
-i |
Path to the image file | required |
--color-format |
-c |
Output color format (hex, rgb, hsl, cmyk) |
required |
--quant |
-q |
Number of dominant colors to extract | 5 |
--visible-swath |
-v |
Render inline terminal color swatches | false |
Extract the top 5 colors from an image as hex:
imq --image photo.jpg --color-format hexExtract the top 8 colors in RGB with terminal swatches:
imq --image photo.jpg --color-format rgb --quant 8 --visible-swathExtract colors in HSL for use in a script (no swatches):
imq --image photo.jpg --color-format hsl --quant 3By default, output is plain text with no ANSI escape codes — safe to pipe into
other programs. Pass --visible-swath to render inline terminal color swatches.
| Format | Status |
|---|---|
hex |
Supported |
rgb |
Supported |
hsl |
Supported |
cmyk |
Supported |
lab |
Planned |
| Format | Status |
|---|---|
| JPEG / JPG | Supported |
| PNG | Supported |
| WebP | Supported |