mirror of
https://codeberg.org/JasterV/Image-Processing-CLI.git
synced 2026-04-26 18:10:07 +00:00
Rotate implemented
Now the user can rotate the image 90|180|270 degrees
This commit is contained in:
parent
3e176fa9cb
commit
117243634a
2 changed files with 12 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -13,3 +13,5 @@ Cargo.lock
|
|||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
||||
/mock
|
||||
|
|
|
|||
11
src/main.rs
11
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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue