stdin read

This commit is contained in:
2024-07-07 15:41:53 +02:00
parent e0f043bb77
commit 2e87792a7f
5 changed files with 87 additions and 2 deletions

View File

@@ -5,8 +5,20 @@ fn main() {
println!("ASCII Generator\n----------------");
let args = libs::args::Args::parse();
let path = args.image.clone();
let mut img = if !path.is_empty() {
libs::image::load_image(&path)
} else {
match libs::image::load_image_from_stdin() {
Ok(img) => img,
Err(e) => {
eprintln!("Error: {e}");
std::process::exit(1);
}
}
};
let mut img = libs::image::load_image(&args.image);
libs::image::print_size(&img);
if !args.noresize {