Skip to content

Commit

Permalink
Switch to Lanczos3
Browse files Browse the repository at this point in the history
Signed-off-by: lloydmeta <[email protected]>
  • Loading branch information
lloydmeta committed Nov 2, 2024
1 parent 07a3535 commit 23aad79
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions server/src/infra/image_manipulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,18 @@ pub struct SingletonOperationsRunner;

impl OperationsRunner for SingletonOperationsRunner {
async fn run(&self, image: DynamicImage, operations: &Operations) -> DynamicImage {
operations.0.iter().fold(image, |mut next, op| {
next = match op {
Operation::Resize { width, height } => {
let resize_to_width = if *width == 0 { next.width() } else { *width };
let resize_to_height = if *height == 0 { next.height() } else { *height };
next.resize(
resize_to_width,
resize_to_height,
image::imageops::FilterType::Gaussian,
)
}
Operation::FlipHorizontally => next.fliph(),
Operation::FlipVertically => next.flipv(),
};
next
operations.0.iter().fold(image, |next, op| match op {
Operation::Resize { width, height } => {
let resize_to_width = if *width == 0 { next.width() } else { *width };
let resize_to_height = if *height == 0 { next.height() } else { *height };
next.resize(
resize_to_width,
resize_to_height,
image::imageops::FilterType::Lanczos3,
)
}
Operation::FlipHorizontally => next.fliph(),
Operation::FlipVertically => next.flipv(),
})
}
}
Expand Down

0 comments on commit 23aad79

Please sign in to comment.