From f397e6563405ddf8e75d97d58093dc758e41688a Mon Sep 17 00:00:00 2001 From: Sindre Johansen Date: Wed, 14 Feb 2018 12:44:00 +0100 Subject: [PATCH] Add crop_image to MagickWand --- src/wand/magick.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wand/magick.rs b/src/wand/magick.rs index 60ec8e4..4e7a817 100644 --- a/src/wand/magick.rs +++ b/src/wand/magick.rs @@ -234,6 +234,16 @@ impl MagickWand { } } + /// Extract a region of the image. The width and height is used as the size + /// of the region. X and Y is the offset. + pub fn crop_image(&self, width: usize, height: usize, x: isize, y: isize) { + unsafe { + bindings::MagickCropImage( + self.wand, width as size_t, height as size_t, x as ssize_t, y as ssize_t, + ); + } + } + /// Resize the image to fit within the given dimensions, maintaining /// the current aspect ratio. pub fn fit(&self, width: size_t, height: size_t) {