Crates.io | print_image |
lib.rs | print_image |
version | 0.1.2 |
source | src |
created_at | 2024-04-07 04:59:50.288109 |
updated_at | 2024-04-07 05:17:10.208858 |
description | Print an image to the terminal! |
homepage | |
repository | https://github.com/m1chaelwilliams/print-image |
max_upload_size | |
id | 1198761 |
size | 38,571 |
A super simple solution to printing images in the terminal
use print_image;
use std::path::Path;
fn main() -> Result<(), print_image::PrintImageError> {
print_img(
Path::new("path/to/file.png"),
Some((12, 12)),
print_image::handle_pixel_rgb
)
}
use print_image;
use std::path::Path;
fn main() -> Result<(), print_image::PrintImageError> {
print_img(
Path::new("path/to/file.png"),
Some((12, 12)),
|pixel| {
match pixel[0] {
0..=128 => "+".to_string(),
129..=255 => "-".to_string()
}
}
)
}
99.99% of the legwork was done by the dependencies for this project. Print Image only provides an easy to use wrapper over them.
Code is licensed under MIT. Click here for more information.