Pixelization
Pixelization is a high-performance Rust library and CLI tool for transforming images into pixel art.
It implements advanced quantization algorithms, including:
- K-Means Clustering: A classic statistical approach to find the best color palette.
- Pixelated Image Abstraction (PIA): An implementation of the paper Pixelated Image Abstraction (Gerstner et al., 2012), which utilizes superpixels and bilateral filtering to create aesthetically pleasing, structure-aware pixel art.
Example Output
| Original | K-Means | PIA |
|---|---|---|
Installation
As a CLI Tool
You can install the binary directly from crates.io (once published) or from source:
# From source
⚠️ System Requirements (Read before installing):
This library uses ndarray-linalg, which requires a BLAS backend.
- Ubuntu/Debian:
sudo apt-get install libopenblas-dev gfortran - macOS: The Accelerate framework is usually built-in, but you may need
gfortran(via brew). - Windows: You may need to install a pre-compiled LAPACK/BLAS binary or use
vcpkg.
As a Library
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
CLI
# Basic usage with PIA (default)
# Using K-Means with specific output path
Rust Code
use ;
Algorithms
- K-Means: Good for general color reduction. Fast.
- PIA: Excellent for preserving shapes and cartoons. It uses an iterative process involving superpixels, graph cuts, and palette optimization.
License
This project is licensed under the MIT License.