From: Dirk Lemstra Date: Thu, 8 Feb 2018 22:31:59 +0000 (+0100) Subject: Added ping support to the heic coder (#507). X-Git-Tag: 7.0.7-23~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4013dc7ea28c8e1faad1255ac4942b7fa5da2026;p=imagemagick Added ping support to the heic coder (#507). --- diff --git a/coders/heic.c b/coders/heic.c index 0e0cd2d09..86c7cc4a7 100644 --- a/coders/heic.c +++ b/coders/heic.c @@ -1107,6 +1107,7 @@ static Image *ReadHEICImage(const ImageInfo *image_info, image=DestroyImageList(image); return((Image *) NULL); } + cropped=(Image *) NULL; length=GetBlobSize(image); count = MAX_ATOMS_IN_BOX; @@ -1137,19 +1138,25 @@ static Image *ReadHEICImage(const ImageInfo *image_info, image->rows = 512 * (ctx.grid.rowsMinusOne + 1); image->depth=8; - ctx.tmp = CloneImage(image, 256, 256, MagickTrue, exception); - if (ctx.tmp == NULL) { - (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError, - "MemoryAllocationFailed","`%s'",image->filename); + status=SetImageExtent(image,image->columns,image->rows,exception); + if (status == MagickFalse) goto cleanup; - } - DuplicateBlob(ctx.tmp, image); + if (image_info->ping == MagickFalse) + { + ctx.tmp = CloneImage(image, 256, 256, MagickTrue, exception); + if (ctx.tmp == NULL) { + (void) ThrowMagickException(exception,GetMagickModule(), + ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename); + goto cleanup; + } - for (i = 0; i < count; i++) { - decodeH265Image(image, &ctx, i+1, exception); - } + DuplicateBlob(ctx.tmp, image); + for (i = 0; i < count; i++) { + decodeH265Image(image, &ctx, i+1, exception); + } + } crop_info.x = 0; crop_info.y = 0; @@ -1242,9 +1249,13 @@ static Image *ReadHEICImage(const ImageInfo *image_info, cropped = CropImage(image, &crop_info, exception); image = DestroyImage(image); - if (cropped != NULL) - SetImageColorspace(cropped, YCbCrColorspace, exception); + { + if (image_info->ping != MagickFalse) + cropped->colorspace=YCbCrColorspace; + else + SetImageColorspace(cropped,YCbCrColorspace,exception); + } cleanup: if (image) {