| Crates.io | image-colorizer |
| lib.rs | image-colorizer |
| version | 1.1.4 |
| created_at | 2024-07-26 05:26:23.113299+00 |
| updated_at | 2024-08-12 03:50:55.384421+00 |
| description | Never settle for images outside your colorscheme again! |
| homepage | |
| repository | https://github.com/TaylorBeeston/image-colorizer |
| max_upload_size | |
| id | 1315803 |
| size | 136,331 |
Never settle for images outside your colorscheme again! Now 🔥B l a z i n g F a s t🔥 thanks to 🦀Rust and 🖥️WGSL
paru -Syu image-colorizer # Or whatever AUR helper you use. yay, pikaur, etc
cargo install image-colorizer
I am currently working on adding support for other package managers, such as the brew, deb, etc.
image-colorizer input_image1.jpg # Outputs input_image1_{colorscheme}.jgp
image-colorizer -o ./processed_images input_image1.jpg input_image2.png
Before you begin, ensure you have a GPU that supports WebGPU
To use the Image Colorizer, run the following command:
image-colorizer [OPTIONS] <IMAGE_PATHS>...
-b, --blend-factor <FACTOR>: Set the blend factor (0.0-1.0)--interpolation-threshold <THRESHOLD>: Set the interpolation threshold (0.0-100.0)-d, --dither-amount <AMOUNT>: Set the dither amount (0.0-1.0)--spatial-averaging-radius <RADIUS>: Set the spatial averaging radius (0-100)-c, --config <CONFIG_FILE>: Specify a custom config file-o, --output <OUTPUT_DIR>: Set the output directory-h, --help: Print help informationYou can customize the colorizer's behavior by creating a configuration file. The default location for the config file is ~/.config/colorizer/config.toml. Here's an example configuration:
blend_factor = "0.9"
colorscheme = "kanagawa"
interpolation_threshold = "2.5"
dither_amount = "0.1"
spatial_averaging_radius = "10"
You can also create custom color schemes by adding a TOML file with the color values in the ~/.config/colorizer/ directory.
he Image Colorizer uses a sophisticated combination of CPU and GPU processing to efficiently transform images. Here's a detailed overview of the process:
graph TD
A[Load Colorscheme] -->|CPU| B[Interpolate Colorscheme]
B --> C[Load Image]
C --> D[Initialize GPU]
D --> E[Pass Image to GPU]
E --> F[Find Closest Colors]
F --> G[Apply Dithering]
G --> H[Pass Image back to CPU]
H --> I[Create Summed Area Table SAT]
I --> J[Pass SAT to GPU]
J --> K[Perform Spatial Averaging]
K --> L[Transfer Luminance from Original]
L --> M[Pass Final Image to CPU]
M --> N[Save Processed Image]
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE.md file for details.