From be0c6f5914cd57d594e33d22308cbf2742aedb0d Mon Sep 17 00:00:00 2001 From: Magic Len Date: Sun, 12 Aug 2018 22:45:19 +0800 Subject: [PATCH] Binding for sharpen_image --- src/wand/magick.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/wand/magick.rs b/src/wand/magick.rs index 4888ed3..9b3767c 100644 --- a/src/wand/magick.rs +++ b/src/wand/magick.rs @@ -362,6 +362,25 @@ impl MagickWand { } } + /// Sharpens an image. We convolve the image with a Gaussian operator of the + /// given radius and standard deviation (sigma). For reasonable results, the + /// radius should be larger than sigma. Use a radius of 0 and SharpenImage() + /// selects a suitable radius for you. + /// + /// radius: the radius of the Gaussian, in pixels, not counting the center pixel. + /// + /// sigma: the standard deviation of the Gaussian, in pixels. + /// + pub fn sharpen_image(&self, radius: f64, sigma: f64) -> Result<(), &'static str> { + match unsafe { bindings::MagickSharpenImage(self.wand, radius, sigma) } { + + bindings::MagickBooleanType::MagickTrue => Ok(()), + + _ => Err("SharpenImage returned false") + + } + } + /// Returns the image resolution as a pair (horizontal resolution, vertical resolution) pub fn get_image_resolution(&self) -> Result<(f64, f64), &'static str> { let mut x_resolution = 0f64;