1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! # Pixelization
//!
//! `pixelization` is an image quantization and pixelization library.
//! It implements standard strategies like **K-Means Clustering** and complex, structure-aware
//! strategies like **Pixelated Image Abstraction (PIA)**.
//!
//! ## Examples
//!
//! ### Basic K-Means
//! Fast and simple color reduction.
//!
//! ```no_run
//! use pixelization::{KmeansPixelizer, Pixelizer, ColorType};
//!
//! let img = image::open("input.png").unwrap();
//! let pixelizer = KmeansPixelizer::new(3, 20, ColorType::Lab);
//!
//! // Downscale to 64x64 and reduce to 8 colors
//! let result = pixelizer.pixelize(&img, 64, 64, 8).unwrap();
//! result.save("output_kmeans.png").unwrap();
//! ```
//!
//! ### Pixelated Image Abstraction (PIA)
//! Structure-aware pixelization using the default parameters from the original paper that you can find at <https://pixl.cs.princeton.edu/pubs/Gerstner_2012_PIA/index.php>.
//!
//! ```no_run
//! use pixelization::{PIAPixelizer, Pixelizer};
//!
//! let img = image::open("input.png").unwrap();
//!
//! // Use default parameters (m=45.0, alpha=0.7, etc.)
//! // This is recommended for most images.
//! let mut pixelizer = PIAPixelizer::default();
//!
//! // Optional: Enable verbose logging to see iteration progress
//! pixelizer.set_verbose(true);
//!
//! // PIA is computationally intensive; small target sizes (e.g., 64x64) are recommended.
//! let result = pixelizer.pixelize(&img, 64, 64, 8).unwrap();
//! result.save("output_pia.png").unwrap();
//! ```
// Re-export specific items to make them easy to access
pub use ;
pub use KmeansPixelizer;
pub use PIAPixelizer;