diff options
author | gennyble <gen@nyble.dev> | 2024-01-16 15:06:29 -0600 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2024-01-16 15:06:29 -0600 |
commit | c887f5fef803e720052898b9561028dfd50e51db (patch) | |
tree | 0ea9c8c9e6c4603d0626bc12e653b6421f16f78a /squash | |
parent | bbbac45d835dd40c3fb53f8c7f9a2731783841e8 (diff) | |
download | colorsquash-c887f5fef803e720052898b9561028dfd50e51db.tar.gz colorsquash-c887f5fef803e720052898b9561028dfd50e51db.zip |
ability to choose kmeans implementation
Diffstat (limited to 'squash')
-rw-r--r-- | squash/Cargo.toml | 2 | ||||
-rw-r--r-- | squash/src/main.rs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/squash/Cargo.toml b/squash/Cargo.toml index 7d33b5b..971afce 100644 --- a/squash/Cargo.toml +++ b/squash/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/gennyble/colorsquash/tree/main/squash" [dependencies] # the meat 'o the thing! the meaning behind it all -colorsquash = { path = "..", version = "0.2.0", features = ["gifed", "kmeans"] } +colorsquash = { path = "..", version = "0.2.0", features = ["gifed"] } # just useful tools for writing binaries anyhow = "1.0.75" diff --git a/squash/src/main.rs b/squash/src/main.rs index a7cc66b..24d557f 100644 --- a/squash/src/main.rs +++ b/squash/src/main.rs @@ -31,10 +31,12 @@ fn main() -> Result<(), anyhow::Error> { builder = builder.selector(sorsel); } - cli::Selector::Kmeans => builder = builder.selector(Kmeans), + cli::Selector::Kmeans => builder = builder.selector(Kmeans { max_iter: 10 }), }; + let start = std::time::Instant::now(); let mut squasher = builder.build(&image.data); + println!("{:.2}ms", start.elapsed().as_secs_f32()); let size = squasher.map_over(&mut image.data); image.data.resize(size, 0); |