A blazingly fast interpolated LUT generator using gaussian distribution for arbitrary and popular color palettes.
bash
cargo install lutgen
```text Usage: lutgen [OPTIONS] [CUSTOM_COLORS]...
Arguments:
[CUSTOM_COLORS]...
List of custom hexidecimal colors to add to the palette. If -p
is not used to specify a base palette, at least 1 color is required
Options:
-p lutgen -p
to view all options
-a
[default: gaussian-v1]
Possible values:
- gaussian-v1: Fastest algorithm for gaussian interpolated remapping
- gaussian-v0: Original algorithm for gaussian interpolated remapping
- nearest-neighbor: Non-interpolated algorithm that remaps to the nearest neighbor
-o, --output
-l, --level
[default: 8]
-m, --mean
[default: 4]
-s, --std-dev
[default: 20]
-i, --iterations
[default: 512]
-h, --help Print help (see a summary with '-h')
-V, --version Print version ```
By default, the
bin
feature and dependencies are enabled. When used as a library, it's recommended to usedefault-features = false
to minimalize the dependency tree and build time.
Simple usage:
```rust use exoquant::{ Color, SimpleColorSpace, }; use lutgen::{ interpolatedremap::{ GaussianV0Params, GaussianV0Remapper, GaussianV1Params, GaussianV1Remapper }, generatelut, };
// Setup the palette and colorspace for nearest neighbor lookups. let palette = vec![ Color::new(255, 0, 0, 255), Color::new(0, 255, 0, 255), Color::new(0, 0, 255, 255), ]; let colorspace = SimpleColorSpace::default();
// Generate a lut using the slower v0 algorithm
let params = GaussianV0Params {
mean: 4.0,
stddev: 20.0,
iterations: 512,
seed: 80085,
colorspace: SimpleColorSpace::default(),
};
let output = generatelut::
// Generate a lut using the faster v1 algorithm
let params = GaussianV1Params {
mean: 4.0,
stddev: 20.0,
iterations: 512,
seed: 80085,
colorspace: SimpleColorSpace::default(),
};
let output = generatelut::
Advanced usage:
```rust use exoquant::{ Color, SimpleColorSpace, }; use lutgen::{ generatelut, interpolatedremap::{GaussianV1Params, GaussianV1Remapper, InterpolatedRemapper}, };
// Generate the base identity let mut identity = lutgen::identity::generate(8);
// Setup the palette let palette = vec![ Color::new(255, 0, 0, 255), Color::new(0, 255, 0, 255), Color::new(0, 0, 255, 255), ];
// Setup the interpolated remapper let params = GaussianV1Params { mean: 4.0, std_dev: 20.0, iterations: 512, seed: 80085, colorspace: SimpleColorSpace::default(), }; let remapper = GaussianV1Remapper::new(&palette, params);
// Remap the identity remapper.remap_image(&mut identity);
// Save the output // identity.save("v1hald8.png").unwrap(); ```