From: glennrp Date: Tue, 17 Jan 2012 21:35:21 +0000 (+0000) Subject: Don't write ancillary chunks in PNG-encoded ICO files. X-Git-Tag: 7.0.1-0~6358 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa192b15c78ecafb5ee45ea185519ba2cf4e1f60;p=imagemagick Don't write ancillary chunks in PNG-encoded ICO files. --- diff --git a/coders/icon.c b/coders/icon.c index 3fdc25690..9dd025ea1 100644 --- a/coders/icon.c +++ b/coders/icon.c @@ -40,6 +40,7 @@ Include declarations. */ #include "MagickCore/studio.h" +#include "MagickCore/artifact.h" #include "MagickCore/blob.h" #include "MagickCore/blob-private.h" #include "MagickCore/cache.h" @@ -883,6 +884,11 @@ static MagickBooleanType WriteICONImage(const ImageInfo *image_info, return(MagickFalse); write_info=CloneImageInfo(image_info); (void) CopyMagickString(write_info->filename,"PNG:",MaxTextExtent); + + /* Don't write any ancillary chunks except for gAMA and tRNS */ + (void) SetImageArtifact(write_image,"png:include-chunk", + "none,trns,gama"); + png=(unsigned char *) ImageToBlob(write_info,write_image,&length, exception); write_image=DestroyImage(write_image); diff --git a/coders/png.c b/coders/png.c index 6c728063d..28afe9400 100644 --- a/coders/png.c +++ b/coders/png.c @@ -11113,7 +11113,9 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info, * well as a comma-separated list. Chunks that are unknown to * ImageMagick are always excluded, regardless of their "copy-safe" * status according to the PNG specification, and even if they - * appear in the "include-chunk" list. + * appear in the "include-chunk" list. Such defines appearing among + * the image options take priority over those found among the image + * artifacts. * * Finally, all chunks listed in the "unused_chunks" array are * automatically excluded, regardless of the other instructions