https://github.com/ozwaldorf/lutgen-rs
Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes.
https://github.com/ozwaldorf/lutgen-rs
cli color-grading colorscheme hald-clut linux-desktop rice rust theming wallpaper
Last synced: 8 months ago
JSON representation
Blazingly fast interpolated LUT generator and applicator for arbitrary and popular color palettes.
- Host: GitHub
- URL: https://github.com/ozwaldorf/lutgen-rs
- Owner: ozwaldorf
- License: mit
- Created: 2023-05-13T01:25:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T23:54:05.000Z (about 1 year ago)
- Last Synced: 2025-04-06T17:03:28.840Z (9 months ago)
- Topics: cli, color-grading, colorscheme, hald-clut, linux-desktop, rice, rust, theming, wallpaper
- Language: Rust
- Homepage: https://docs.rs/lutgen
- Size: 31.2 MB
- Stars: 356
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
lutgen-rs
A blazingly fast interpolated LUT utility 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

## CLI
### Installation
[](https://repology.org/project/lutgen/versions)
#### Source
```bash
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:
```bash
nix run github:ozwaldorf/lutgen-rs
```
Cache is provided via https://garnix.io
### Documentation
Detailed cli documentation is available at [docs/README.md](./docs/README.md).
### Examples
Correcting an image
```bash
# 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 with whitespace separated hex colors (linux example shown)
echo "fff 555 000 abcdef deadbe" > ~/.config/lutgen/my-palette-name
lutgen apply docs/example-image.jpg -p my-palette-name
# 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
```bash
# 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 whitespace separated hex colors (linux example shown)
echo "fff 555 000 abcdef deadbe" > ~/.config/lutgen/my-palette-name
lutgen generate -p my-palette-name
```
Preview palletes
```bash
# Preview all palettes
lutgen palette all
# Copy a palette to the custom palette dir for modifying and overriding
lutgen palette carburetor > ~/.config/lutgen/carburetor
# Finding a palette name with grep
lutgen palette names | grep 'gruvbox'
```
Correcting videos (using ffmpeg):
```bash
ffmpeg -i input.mkv -i hald_clut.png -filter_complex '[0][1] haldclut' output.mp4
```
Zsh Completions:
```bash
lutgen --bpaf-complete-style-zsh > _lutgen
sudo mv _lutgen /usr/local/share/zsh/site-functions/
```
## Library
See the latest documentation on [docs.rs](https://docs.rs/lutgen)
## Planned features
- [ ] Interpolation for more accuracy when correcting with low level luts (<16)
- [ ] Hardware acceleration for applying luts to images
## Sources
- Hald Cluts: https://www.quelsolaar.com/technology/clut.html
- Editing with Hald Cluts: https://im.snibgo.com/edithald.htm
- Sparse Hald Cluts: https://im.snibgo.com/sphaldcl.htm
- RBF Interpolation: https://en.wikipedia.org/wiki/Radial_basis_function_interpolation
- Shepard's method: https://en.wikipedia.org/wiki/Inverse_distance_weighting
- Oklab Colorspace: https://bottosson.github.io/posts/oklab/
## Special Thanks
- [Gingeh](https://github.com/Gingeh) for the initial inspiration and imagemagick approach
- [The Catppuccin Org](https://github.com/catppuccin) for continual feedback and support along the way
- [Stonks3141](https://github.com/Stonks3141) for maintaining the Alpine Linux package
- All the nixpkgs maintainers