| Crates.io | pixelization |
| lib.rs | pixelization |
| version | 0.1.1 |
| created_at | 2025-12-04 09:49:26.453208+00 |
| updated_at | 2025-12-04 10:29:15.694906+00 |
| description | An image quantization and pixelization library implementing K-Means and PIA (Pixelated Image Abstraction). |
| homepage | https://github.com/AlexandreBinninger/pixelization |
| repository | https://github.com/AlexandreBinninger/pixelization |
| max_upload_size | |
| id | 1966267 |
| size | 111,014 |
Pixelization is a high-performance Rust library and CLI tool for transforming images into pixel art.
It implements advanced quantization algorithms, including:
| Original | K-Means | PIA |
|---|---|---|
⚠️ System Requirements (Read before installing):
This library uses ndarray-linalg, which requires a BLAS backend.
Ubuntu/Debian: sudo apt update && sudo apt install pkg-config libssl-dev libopenblas-dev libx11-dev libxext-dev libxft-dev
macOS: brew install openblas
Windows: You may need to install a pre-compiled LAPACK/BLAS binary or use vcpkg.
You can install the binary directly from crates.io (once published) or from source:
# From source
cargo install --path . --features cli
Add this to your Cargo.toml:
[dependencies]
pixelization = "0.1.1"
# Basic usage with PIA (default)
pixelize input.jpg --scale 4 --n_colors 8
# Using K-Means with specific output path
pixelize input.jpg -o output.png --method kmeans --n_colors 16 --scale 2
use pixelization::{PIAPixelizer, Pixelizer};
fn main() {
let img = image::open("assets/images/ferris_3d.png").unwrap();
// Configure PIA
let mut pia = PIAPixelizer::default();
pia.set_verbose(true);
// Pixelize: (image, width, height, number_of_colors)
let result = pia.pixelize(&img, 64, 64, 8).unwrap();
result.save("output.png").unwrap();
}
This project is licensed under the MIT License.