]> granicus.if.org Git - imagemagick/commitdiff
Also skip text:density chunk found in a PNG datastream by the PNG decoder,
authorglennrp <glennrp@git.imagemagick.org>
Mon, 7 Mar 2011 01:06:55 +0000 (01:06 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Mon, 7 Mar 2011 01:06:55 +0000 (01:06 +0000)
if a pHYs chunk is also present.

ChangeLog
coders/png.c

index 19b0f9626c6c62fb5b3b53a1b58f0cb8872e54ec..0e7174d17b7ea117e1cfe7181c95dfcd90d732c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
   * Don't write a PNG text chunk with "density" keyword that overrides the
     PNG pHYs chunk, if the pHYs chunk was not excluded (reference
     http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=18225).
+  * Ignore any PNG text chunk with a "density" keyword found by the PNG
+    decoder, if the PNG datastream also contains a pHYs chunk.
 
 2011-03-06  6.6.8-2 Cristy  <quetzlzacatenango@image...>
   * Support the Radiance HDR image format.
index be876ef8ff1908f6342bb44c1a43ac50b1fae33c..9f5dda62804f936cd0decb474e6e8e501ee1afa2 100644 (file)
@@ -2882,7 +2882,11 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
             }
           *value='\0';
           (void) ConcatenateMagickString(value,text[i].text,length+2);
-          (void) SetImageProperty(image,text[i].key,value);
+
+          /* Don't save "density" property if we have a pHYs chunk */
+          if (LocaleCompare(text[i].key,"density") != 0 ||
+              !png_get_valid(ping,ping_info,PNG_INFO_pHYs))
+             (void) SetImageProperty(image,text[i].key,value);
 
           if (logging != MagickFalse)
           {