Add sample method

This commit is contained in:
asonix
2020-10-10 17:42:35 -05:00
parent ce36ba8cff
commit 4dda874de1

View File

@ -677,6 +677,18 @@ impl MagickWand {
}
}
/// Sample the image to the target resolution
///
/// This is incredibly fast, as it does 1-1 pixel mapping for downscales, and box filtering for
/// upscales
pub fn sample_image(&self, width: usize, height: usize) -> Result<(), &'static str> {
let result = unsafe { bindings::MagickSampleImage(self.wand, width, height) };
match result {
bindings::MagickBooleanType_MagickTrue => Ok(()),
_ => Err("failed to sample image"),
}
}
/// Resample the image to the specified horizontal and vertical resolution, using the
/// specified filter type.
pub fn resample_image(