From 471fc164cfad9d13c224591e6fa5315f5799868e Mon Sep 17 00:00:00 2001 From: walter Date: Mon, 30 May 2022 14:23:45 -0400 Subject: [PATCH] add support for image deskew --- src/wand/magick.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wand/magick.rs b/src/wand/magick.rs index 4beaee6..d115937 100644 --- a/src/wand/magick.rs +++ b/src/wand/magick.rs @@ -875,6 +875,17 @@ impl MagickWand { } } + /// Removes skew from the image. Skew is an artifact that + /// occurs in scanned images because of the camera being misaligned, + /// imperfections in the scanning or surface, or simply because the paper was + /// not placed completely flat when scanned + pub fn deskew_image(&mut self, threshold: f64) -> Result<()> { + match unsafe { bindings::MagickDeskewImage(self.wand, threshold) } { + bindings::MagickBooleanType_MagickTrue => Ok(()), + _ => Err(MagickError("unable to deskew image")), + } + } + /// Set image channel mask pub fn set_image_channel_mask( &mut self,