3 releases
0.1.2 | Apr 7, 2024 |
---|---|
0.1.1 | Apr 7, 2024 |
0.1.0 | Apr 7, 2024 |
#21 in #resize
12KB
65 lines
Print Image
A super simple solution to printing images in the terminal
Features
- Printing images
- Resizing output
- Custom pixel handling
Usage
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
)
}
Custom Pixel Handler
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()
}
}
)
}
Dependencies
- image - Licensed under MIT or Apache 2.0
- colored - Licensed under Mozilla Public License Version 2.0
99.99% of the legwork was done by the dependencies for this project. Print Image only provides an easy to use wrapper over them.
License
Code is licensed under MIT. Click here for more information.
Dependencies
~3–12MB
~96K SLoC