From 117243634a736281af7baa8481f4b5af64090112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 23 Nov 2020 00:00:43 +0100 Subject: [PATCH] Rotate implemented Now the user can rotate the image 90|180|270 degrees --- .gitignore | 2 ++ src/main.rs | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 22d3516..1ce1458 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ Cargo.lock # Added by cargo /target + +/mock diff --git a/src/main.rs b/src/main.rs index 4e15a22..9cee115 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use lib::cli; fn main() { let matches = cli::build_cli().get_matches(); - + let input = matches.value_of("INPUT").unwrap(); let output = matches.value_of("OUTPUT").unwrap(); @@ -41,6 +41,15 @@ fn edit_photo(mut image: DynamicImage, matches: &ArgMatches) -> DynamicImage { if let Some(degrees) = matches.value_of("huerotate") { image = image.huerotate(degrees.parse().unwrap()); } + // ROTATE IMAGE + if let Some(degrees) = matches.value_of("rotate") { + match degrees { + "90" => image = image.rotate90(), + "180" => image = image.rotate180(), + "270" => image = image.rotate270(), + _ => {} + } + } // GRAY SCALE if matches.is_present("grayscale") { image = image.grayscale();