Merge pull request #72 from asonix/asonix/sample-image
Add sample method
This commit is contained in:
@ -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
|
/// Resample the image to the specified horizontal and vertical resolution, using the
|
||||||
/// specified filter type.
|
/// specified filter type.
|
||||||
pub fn resample_image(
|
pub fn resample_image(
|
||||||
|
|||||||
Reference in New Issue
Block a user