Palettum is a web app and CLI tool that lets you recolor images, GIFs, and videos with any custom palette of your choosing.
It lets you apply any custom palette by either snapping each pixel to its closest color (ideal for pixel-art styles), or blending the palette as a filter for a smoother effect.
Note
Unfinished
Original artwork by lgarabato
Original | Catppuccin | Dracula | Nord | Gruvbox |
---|---|---|---|---|
Note
Unfinished
macOS:
brew tap arrowpc/palettum
brew install palettum
If your system/package manager wasn't listed, you can install the precompiled binary from releases.
If you want to build the project from source, follow these steps:
To build the command-line interface (CLI) tool, run the following Cargo command from the project root:
cargo build -p cli
The executable will be located in the target/debug/
directory (or target/release/
if you add the --release
flag).
The web application uses a WebAssembly module compiled from Rust code.
Important
It is highly recommended to use rustup
for managing Rust toolchains rather than a system-wide installation. This helps avoid potential issues, especially when compiling for wasm32-unknown-unknown
targets.
To set up and run the web application:
-
Navigate to the web frontend:
cd web
-
Install dependencies:
bun install
-
Compile the WASM binary (release mode):
bun run wasm:build:release
-
Run the development server:
bun run dev
To build and run the web application using Docker:
-
Build the Docker image:
docker build -t palettum .
-
Run the Docker container:
docker run -p 80:80 palettum
The web application will then be accessible in your browser at
http://localhost
- The main color difference formula (CIEDE2000) was implemented through the help of this paper: https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/ciede2000noteCRNA.pdf. The rest were easy to implement through the color difference wiki: https://en.wikipedia.org/wiki/Color_difference.
- The fast trig approximation functions were inspired/taken from:
- atan / atan2: https://mazzo.li/posts/vectorized-atan2.html
- sin: Basic taylor series https://en.wikipedia.org/wiki/Taylor_series
- cos: https://github.com/milianw/cosine/tree/parabola-approx
- exp: https://stackoverflow.com/questions/47025373/fastest-implementation-of-the-natural-exponential-function-using-sse
- Smoothing was done with basic L* a* b* interpolation using:
- Palette extraction (adjusted for L* a* b colorspace): https://www.ece.mcmaster.ca/~xwu/cq.c