Skip to content

Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes.

License

Notifications You must be signed in to change notification settings

ozwaldorf/lutgen-rs

Repository files navigation


lutgen-rs

crate license publish ci

A blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes. Theme any image to your desktop colorscheme!


Example Output

Hald Cluts

Catppuccin Mocha
Gruvbox Dark
Nord

Color Corrections

Original Image
Catppuccin Mocha
Gruvbox Dark
Nord

Usage

Note: The binary usages are fairly stable, but any release that does make any breaking changes as such, are bumped to 0.X.0

CLI

Packaging status

Source

git clone https://github.com/ozwaldorf/lutgen-rs
cd lutgen-rs
cargo install --path .

Nix flake

A nix flake is available and can be run easily with:

nix run github:ozwaldorf/lutgen-rs

Cache is provided via https://garnix.io

Helptext

Usage: lutgen <COMMAND>

Commands:
  generate     Generate a hald clut for external or manual usage
  apply        Correct an image using a hald clut, either generating it, or loading it externally
  patch        Generate a patch for rgb colors inside text files
  palette      Print palette colors and names
  completions  Generate shell completions
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Examples

Correcting an image

# Builtin palette
lutgen apply -p catppuccin-mocha docs/example-image.jpg -o mocha_version.jpg

# Custom colors
lutgen apply docs/example-image.jpg -- "#ABCDEF" ffffff 000000

# Custom palette file
lutgen apply docs/example-image.jpg -- $(cat palette.txt)

# Multiple images
lutgen apply image1.png image2.png *.jpg -p catppuccin-mocha

# Using an external LUT
lutgen apply --hald-clut mocha_lut.png docs/example-image.jpg

Generating a standalone LUT for external or manual usage

# Builtin palette
lutgen generate -p catppuccin-mocha -o mocha_lut.png

# Custom colors
lutgen generate -o custom.png -- "#ABCDEF" ffffff 000000

# Custom palette file with hex codes
lutgen generate -o custom.png -- $(cat palette.txt)

Palletes

# Preview all palettes
lutgen palette

# Copy a palette to a file for tweaking
lutgen palette carburetor > carburetor.txt

# Finding a palette name with grep
lutgen palette --name-only | grep 'gruvbox'

Correcting videos (using ffmpeg):

ffmpeg -i input.mkv -i hald_clut.png -filter_complex '[0][1] haldclut' output.mp4

Zsh Completions

lutgen completions zsh > _lutgen
sudo mv _lutgen /usr/local/share/zsh/site-functions/

Library

See the latest documentation on docs.rs

Planned features

  • Interpolation for more accuracy when correcting with low level luts (<16)
  • Hardware acceleration for applying luts to images

Sources

Special Thanks

  • Stonks3141 for maintaining the Alpine Linux package
  • All the nixpkgs maintainers