Rotate implemented

Now the user can rotate the image 90|180|270 degrees
This commit is contained in:
Víctor Martínez 2020-11-23 00:00:43 +01:00
parent 3e176fa9cb
commit 117243634a
2 changed files with 12 additions and 1 deletions

2
.gitignore vendored
View file

@ -13,3 +13,5 @@ Cargo.lock
# Added by cargo
/target
/mock

View file

@ -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();