Merge pull request #109 from protochron/add_autothreshold

Add auto_threshold
This commit is contained in:
Nathan Fiedler
2023-10-23 09:18:28 -07:00
committed by GitHub

View File

@ -1017,6 +1017,17 @@ impl MagickWand {
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!(
/// Set the image colorspace, transforming (unlike `set_image_colorspace`) image data in
/// the process.