Add auto_threshold

This commit is contained in:
Dan Norris
2023-10-22 22:44:29 -04:00
parent b676db0661
commit 1ddf6cf4b9

View File

@ -1017,6 +1017,17 @@ impl MagickWand {
res == bindings::MagickBooleanType_MagickTrue res == bindings::MagickBooleanType_MagickTrue
} }
/// Automatically performs threshold method to reduce grayscale data
/// down to a binary black & white image. Included algorithms are
/// Kapur, Otsu, and Triangle methods.
/// See <https://imagemagick.org/api/magick-image.php#MagickAutoThresholdImage> for more information.
pub fn auto_threshold(&self, method: bindings::AutoThresholdMethod) -> Result<()> {
match unsafe { bindings::MagickAutoThresholdImage(self.wand, method) } {
bindings::MagickBooleanType_MagickTrue => Ok(()),
_ => Err(MagickError("unable to auto threshold image")),
}
}
mutations!( mutations!(
/// Set the image colorspace, transforming (unlike `set_image_colorspace`) image data in /// Set the image colorspace, transforming (unlike `set_image_colorspace`) image data in
/// the process. /// the process.