From 76e037b7f20b39324664018c1fafbd5017dccaac Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sat, 1 Sep 2018 19:25:49 +0200 Subject: [PATCH] Use the width and height of the extract area when no size is specified. --- coders/gradient.c | 15 +++++++++++++++ coders/xc.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/coders/gradient.c b/coders/gradient.c index 7753bb979..04c7792e9 100644 --- a/coders/gradient.c +++ b/coders/gradient.c @@ -124,6 +124,21 @@ static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception) assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); + if ((image_info->extract != (char *) NULL) && + (image->columns == 0) && (image->rows == 0)) + { + RectangleInfo + geometry; + + int + flags; + + flags=ParseAbsoluteGeometry(image_info->extract,&geometry); + if ((flags & WidthValue) != 0) + image->columns=geometry.width; + if ((flags & HeightValue) != 0) + image->rows=geometry.height; + } if (image->columns == 0) image->columns=1; if (image->rows == 0) diff --git a/coders/xc.c b/coders/xc.c index 21c26920b..441a852cc 100644 --- a/coders/xc.c +++ b/coders/xc.c @@ -120,6 +120,21 @@ static Image *ReadXCImage(const ImageInfo *image_info,ExceptionInfo *exception) assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); + if ((image_info->extract != (char *) NULL) && + (image->columns == 0) && (image->rows == 0)) + { + RectangleInfo + geometry; + + int + flags; + + flags=ParseAbsoluteGeometry(image_info->extract,&geometry); + if ((flags & WidthValue) != 0) + image->columns=geometry.width; + if ((flags & HeightValue) != 0) + image->rows=geometry.height; + } if (image->columns == 0) image->columns=1; if (image->rows == 0) -- 2.40.0