diff --git a/src/post_process/image_processing.rs b/src/post_process/image_processing.rs index 2b8e5cd..c570bef 100644 --- a/src/post_process/image_processing.rs +++ b/src/post_process/image_processing.rs @@ -141,13 +141,18 @@ fn process_static_image_impl(mut image: DynamicImage, opt: &ImageOptions) -> Dyn return image.resize_exact(96, 96, image::imageops::FilterType::Nearest); } + let mut use_bilinear = true; + if opt.emoji == Some(true) { + use_bilinear = false; out_dim = clamp_height(out_dim, 128); } else if opt.avatar == Some(true) { + use_bilinear = false; out_dim = clamp_height(out_dim, 320); } if opt.preview == Some(true) { + use_bilinear = false; out_dim = clamp_dimensions(out_dim, 200, 200); } @@ -156,7 +161,15 @@ fn process_static_image_impl(mut image: DynamicImage, opt: &ImageOptions) -> Dyn } if out_dim != image.dimensions() { - image = image.resize_exact(out_dim.0, out_dim.1, image::imageops::FilterType::Lanczos3); + image = image.resize_exact( + out_dim.0, + out_dim.1, + if use_bilinear { + image::imageops::FilterType::Triangle + } else { + image::imageops::FilterType::Nearest + }, + ); } image