Quantization/palette-generation tool using k-means clustering on pixel data
Go to file
2025-09-16 13:57:07 +02:00
src version 0.7: significant performance update, better progress 2025-09-16 13:57:07 +02:00
.gitignore version 0.6: implement image file output 2025-09-14 20:46:06 +02:00
Cargo.lock version 0.7: significant performance update, better progress 2025-09-16 13:57:07 +02:00
Cargo.toml version 0.7: significant performance update, better progress 2025-09-16 13:57:07 +02:00
LICENSE initial commit: version 0.5 2025-09-13 22:54:01 +02:00
README.md version 0.6: implement image file output 2025-09-14 20:46:06 +02:00

🎨 qtizer

command line quantization/palette-generation tool using k-means clustering on pixel data

features

  • hex and rgb formats
  • output with color previews
  • various supported file types

usage

Usage: qtizer [OPTIONS] <input> [output]

Arguments:
  <input>   Input file path
  [output]  Output file path

Options:
  -k <count>             Number of colors to quantize to [default: 8]
  -n <count>             Number of k-means iterations to perform [default: 5]
  -a, --with-alpha       Include alpha channel
  -s, --seed <number>    Optional RNG seed for reproducible results
  -o, --output <output>  Output file path
                         - If not provided, outputs to stdout
                         - With image file extensions, outputs an image file
  -f, --format <fmt>     Palette output format [possible values: hex, rgb]
  -h, --help             Print help (see more with '--help')
  -V, --version          Print version

Example: palette creation in rgb format with alpha (output is colored accordingly in terminals):

$ qtizer wallpaper.png -k 3 -af rgb

rgba(254, 254, 254, 0)
rgba(191, 150, 132, 254)
rgba(48, 45, 51, 254)

Example: image quantization to reduced palette (file formats inferred based on extension):

$ qtizer wallpaper.png -k 8 quantized.png

installation

git clone https://github.com/mxhagen/qtizer
cd qtizer; cargo build --release
sudo cp target/release/qtizer /usr/local/bin