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.
This commit is contained in:
parent
3fa3c0daf7
commit
bfc55c4f0f
1 changed files with 10 additions and 11 deletions
|
@ -231,7 +231,7 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
|
||||||
{
|
{
|
||||||
Image *mimg;
|
Image *mimg;
|
||||||
Image *resized;
|
Image *resized;
|
||||||
ExceptionInfo *exception;
|
ExceptionInfo exception;
|
||||||
MagickBooleanType ret;
|
MagickBooleanType ret;
|
||||||
int new_width = img->width * factor;
|
int new_width = img->width * factor;
|
||||||
int new_height = img->height * 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. */
|
* result, which improves matching performances in my experiments. */
|
||||||
|
|
||||||
if (!IsMagickInstantiated())
|
if (!IsMagickInstantiated())
|
||||||
MagickCoreGenesis(NULL, MagickFalse);
|
InitializeMagick(NULL);
|
||||||
|
|
||||||
|
GetExceptionInfo(&exception);
|
||||||
|
mimg = ConstituteImage(img->width, img->height, "I", CharPixel, img->data,
|
||||||
|
&exception);
|
||||||
|
|
||||||
exception = AcquireExceptionInfo();
|
GetExceptionInfo(&exception);
|
||||||
|
resized = ResizeImage(mimg, new_width, new_height, 0, 1.0, &exception);
|
||||||
mimg = ConstituteImage(img->width, img->height, "I", CharPixel, img->data, exception);
|
|
||||||
|
|
||||||
ClearMagickException(exception);
|
|
||||||
resized = ResizeImage(mimg, new_width, new_height, 0, 1.0, exception);
|
|
||||||
|
|
||||||
newimg = fpi_img_new(new_width * new_height);
|
newimg = fpi_img_new(new_width * new_height);
|
||||||
newimg->width = new_width;
|
newimg->width = new_width;
|
||||||
newimg->height = new_height;
|
newimg->height = new_height;
|
||||||
newimg->flags = img->flags;
|
newimg->flags = img->flags;
|
||||||
|
|
||||||
ClearMagickException(exception);
|
GetExceptionInfo(&exception);
|
||||||
ret = ExportImagePixels(resized, 0, 0, new_width, new_height, "I",
|
ret = ExportImagePixels(resized, 0, 0, new_width, new_height, "I",
|
||||||
CharPixel, newimg->data, exception);
|
CharPixel, newimg->data, &exception);
|
||||||
if (ret != MagickTrue) {
|
if (ret != MagickTrue) {
|
||||||
fp_err("export failed");
|
fp_err("export failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -266,7 +266,6 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
|
||||||
|
|
||||||
DestroyImage(mimg);
|
DestroyImage(mimg);
|
||||||
DestroyImage(resized);
|
DestroyImage(resized);
|
||||||
DestroyExceptionInfo(exception);
|
|
||||||
|
|
||||||
return newimg;
|
return newimg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue