From 7811a66fd36dbcc7672d42826b32787d0f4dd2d7 Mon Sep 17 00:00:00 2001 From: HichamAz Date: Mon, 24 Oct 2022 16:27:44 +0200 Subject: [PATCH] feat: use better filter for resize (deepzoom) (#9) --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/deepzoom.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 73aa63e..90701a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -479,7 +479,7 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "openslide-rs" -version = "0.3.0" +version = "0.3.1" dependencies = [ "assert_approx_eq", "bencher", diff --git a/Cargo.toml b/Cargo.toml index 21fac5e..2d0ce8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "openslide-rs" edition = "2021" -version = "0.3.0" +version = "0.3.1" authors = ["AzHicham "] description = "Rust bindings of OpenSlide C library" repository = "https://github.com/AzHicham/openslide-rs" diff --git a/src/deepzoom.rs b/src/deepzoom.rs index c2d55b0..7d1d7b8 100644 --- a/src/deepzoom.rs +++ b/src/deepzoom.rs @@ -3,7 +3,7 @@ //! This is a simple translation of python DeepZoomGenerator implementation use crate::{errors::OpenSlideError, Address, DeepZoomGenerator, OpenSlide, Region, Result, Size}; -use image::{RgbImage, RgbaImage}; +use image::{imageops::FilterType, RgbImage, RgbaImage}; impl<'a> DeepZoomGenerator<'a> { pub fn new( @@ -163,10 +163,11 @@ impl<'a> DeepZoomGenerator<'a> { }; if final_size != size { - Ok(image::imageops::thumbnail( + Ok(image::imageops::resize( &image, final_size.w, final_size.h, + FilterType::Lanczos3, )) } else { Ok(image)