lutgen-rs

crate license ci publish

A blazingly fast interpolated LUT generator using gaussian distribution for arbitrary color palettes.


Usage

CLI

bash cargo install lutgen

```text Usage: lutgen [OPTIONS] -p

Options: -p [possible values: catppuccin-mocha, catppuccin-macchiato, catppuccin-frappe, catppuccin-latte] -a Algorithm to generate the LUT with [default: v1] [possible values: v1, v0] -o, --output Path to write the generated file to. Defaults to the current dir with some parameters (ex: ./hald_clut_v1_4_20_512.png) -l, --level HaldCLUT color depth. 8 bit = 512x512 image [default: 8] -m, --mean Mean for the gaussian distribution [default: 4] -s, --std-dev Standard deviation for the gaussian distribution [default: 20] -i, --iterations Number of iterations to average together [default: 512] -h, --help Print help (see more with '--help') -V, --version Print version ```

Library

By default, the bin feature and dependencies are enabled. When used as a library, it's recommended to use default-features = false to minimalize the dependency tree and build time.

Simple usage:

```rust use exoquant::Color;

// Setup the palette and parameters let palette = vec![ Color::new(255, 0, 0, 255), Color::new(0, 255, 0, 255), Color::new(0, 0, 255, 255), ];

// Generate the LUT using the v1 algorithm: let lut = lutgen::generatev1lut(&palette, 8, 4.0, 20.0, 512, 0); // Or, v0: lutgen::generatev0lut(&palette, 8, 4.0, 20.0, 512, 0); ```

Advanced usage:

```rust use exoquant::Color;

// Generate the base identity let identity = lutgen::identity::generate(8);

// Setup the palette and parameters let palette = vec![ Color::new(255, 0, 0, 255), Color::new(0, 255, 0, 255), Color::new(0, 0, 255, 255), ]; let mean = 4.0; let std_dev = 20.0; let iters = 512; let seed = 0;

// Remap the identity using v1: let outputv1 = lutgen::interpolatedremap::v1::remapimage(identity, &palette, mean, stddev, iters, seed); // Or, v0: lutgen::interpolatedremap::v0::remapimage(&identity, &palette, mean, std_dev, iters, seed); ```