From bfc55c4f0f4ff75b52c9d9c2d7b2fffb01c5dc8e Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 16 Nov 2007 12:49:29 +0000 Subject: [PATCH] Use older ImageMagick API Debian ship an ImageMagick that is more than 2 years old. Switch to using older APIs so that we have compatibility all-round. --- libfprint/img.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libfprint/img.c b/libfprint/img.c index 9bc9a512..3db92488 100644 --- a/libfprint/img.c +++ b/libfprint/img.c @@ -231,7 +231,7 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor) { Image *mimg; Image *resized; - ExceptionInfo *exception; + ExceptionInfo exception; MagickBooleanType ret; int new_width = img->width * factor; int new_height = img->height * factor; @@ -242,23 +242,23 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor) * result, which improves matching performances in my experiments. */ if (!IsMagickInstantiated()) - MagickCoreGenesis(NULL, MagickFalse); + InitializeMagick(NULL); + + GetExceptionInfo(&exception); + mimg = ConstituteImage(img->width, img->height, "I", CharPixel, img->data, + &exception); - exception = AcquireExceptionInfo(); - - mimg = ConstituteImage(img->width, img->height, "I", CharPixel, img->data, exception); - - ClearMagickException(exception); - resized = ResizeImage(mimg, new_width, new_height, 0, 1.0, exception); + GetExceptionInfo(&exception); + resized = ResizeImage(mimg, new_width, new_height, 0, 1.0, &exception); newimg = fpi_img_new(new_width * new_height); newimg->width = new_width; newimg->height = new_height; newimg->flags = img->flags; - ClearMagickException(exception); + GetExceptionInfo(&exception); ret = ExportImagePixels(resized, 0, 0, new_width, new_height, "I", - CharPixel, newimg->data, exception); + CharPixel, newimg->data, &exception); if (ret != MagickTrue) { fp_err("export failed"); return NULL; @@ -266,7 +266,6 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor) DestroyImage(mimg); DestroyImage(resized); - DestroyExceptionInfo(exception); return newimg; }