add get_image_page to MagickWand

get_image_page (MagickGetImagePage) is especially useful
for determining the overall dimensions of a GIF, which may have
frames with different widths and heights. In such cases,
get_image_width and get_image_height report the dimensions of
the last frame only.
This commit is contained in:
little-bobby-tables
2017-08-23 19:35:11 +07:00
parent a1d50c2f01
commit f6c55ba836
3 changed files with 21 additions and 0 deletions

View File

@ -152,6 +152,15 @@ impl MagickWand {
}
}
/// Retrieve the page geometry (width, height, x offset, y offset) of the image.
pub fn get_image_page(&self) -> (usize, usize, isize, isize) {
let (mut width, mut height, mut x, mut y) = (0usize, 0usize, 0isize, 0isize);
unsafe {
bindings::MagickGetImagePage(self.wand, &mut width, &mut height, &mut x, &mut y);
}
(width, height, x, y)
}
/// Retrieve the named image property value.
pub fn get_image_property(&self, name: &str) -> Result<String, &'static str> {
let c_name = CString::new(name).unwrap();