Crates.io | pixelize |
lib.rs | pixelize |
version | 0.3.1 |
source | src |
created_at | 2020-02-02 13:50:17.344826 |
updated_at | 2020-04-05 11:08:57.354517 |
description | A CLI tool to pixelate your supplied image. |
homepage | https://github.com/geekyme/pixelize |
repository | https://github.com/geekyme/pixelize |
max_upload_size | |
id | 204202 |
size | 1,517,512 |
This crate provides:
pixelize
function to do the same thingcargo install pixelize
pixelize -i girl.jpg -o girl_10.jpg -d 10
Original | -d 10 |
---|---|
-d 20 | -d 50 |
---|---|
[dependencies]
pixelize = "<version>"
let opts = pixelize::Options {
degree: 10,
preserve_size: false,
};
let in_file = "temp.jpg";
let out_file = "temp_10.jpg";
let buf = fs::read(in_file).unwrap();
let out = pixelize::pixelize(buf.as_slice(), &opts).unwrap();
match out.save(out_file) {
Ok(_) => println!(
"{} pixelated with degree {} and saved to {}",
in_file, &opts.degree, out_file
),
Err(e) => panic!("Error pixelating your image: {}", e),
}