2022-10-03 14:59:34 +00:00
|
|
|
use clap::Parser;
|
|
|
|
use image::GenericImageView;
|
|
|
|
|
|
|
|
extern crate pretty_env_logger;
|
|
|
|
#[macro_use] extern crate log;
|
2022-10-03 14:04:38 +00:00
|
|
|
|
|
|
|
mod args;
|
|
|
|
|
|
|
|
use crate::args::args::Arguments;
|
|
|
|
|
2022-10-03 11:09:12 +00:00
|
|
|
fn main() {
|
2022-10-03 14:59:34 +00:00
|
|
|
// Initialize the logger
|
|
|
|
pretty_env_logger::init();
|
|
|
|
info!("Successfully initialized logger");
|
|
|
|
info!("Parsing arguments");
|
|
|
|
// Parse the arguments
|
2022-10-03 14:04:38 +00:00
|
|
|
let arguments = Arguments::parse();
|
2022-10-03 14:59:34 +00:00
|
|
|
info!("Successfully parsed arguments");
|
|
|
|
trace!("Arguments: {:?}", arguments);
|
|
|
|
|
|
|
|
// Open the image
|
|
|
|
info!("Opening image: {}", arguments.image);
|
|
|
|
let image = match image::open(arguments.image) {
|
|
|
|
Ok(image) => image,
|
|
|
|
Err(e) => {
|
|
|
|
error!("Failed to open image: {:?}", e);
|
|
|
|
eprintln!("Failed to open image: {:?}", e);
|
|
|
|
std::process::exit(1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
info!("Successfully opened image");
|
|
|
|
trace!("Image dimensions: {:?}", image.dimensions());
|
|
|
|
|
2022-10-03 11:09:12 +00:00
|
|
|
}
|