]> granicus.if.org Git - imagemagick/commitdiff
Store PNG IHDR data as properties
authorglennrp <glennrp@git.imagemagick.org>
Wed, 30 Mar 2011 18:47:21 +0000 (18:47 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Wed, 30 Mar 2011 18:47:21 +0000 (18:47 +0000)
ChangeLog
coders/png.c

index f2de5b116b9525649778f9c16a3fa1911b89b05c..c8342647f5274ee6ef651c76bfb03341f7982d93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2011-03-30 6.6.9-2 Anthony Thyssen <A.Thyssen@griffith...>
+2011-03-30  6.6.9-2 Glenn Randers-Pehrson <glennrp@image...>
+  * Revised the png decoder to store the PNG IHDR data as properties, for
+    later retrieval and reporting by "identify", so users can easily and
+    reliably discover the color-type, bit-depth, etc that were in the input
+    PNG datastream.
+
+2011-03-30  6.6.9-2 Anthony Thyssen <A.Thyssen@griffith...>
   * Add a "Resize" distortion method (distort equivalent of -resize).
   * Special CLI handling so -distort Resize takes a "geometry" argument.
 
@@ -8,7 +14,7 @@
 2011-03-29  6.6.9-1 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.9-1.
 
-2011-03-29 6.6.9-1 Anthony Thyssen <A.Thyssen@griffith...>
+2011-03-29  6.6.9-1 Anthony Thyssen <A.Thyssen@griffith...>
   * Fix AdaptiveResizeImage() to use 'Mesh' Interpolation, and fix its
     coordinate handling, as originally defined.
 
@@ -23,7 +29,7 @@
   * Optimize bilinear interpolation.
   * Remove version from etc folder and instead use /etc/ImageMagick.
 
-2011-03-28 6.6.9-0 Anthony Thyssen <A.Thyssen@griffith...>
+2011-03-28  6.6.9-0 Anthony Thyssen <A.Thyssen@griffith...>
   * Separated complex cropping function from TransformImage() as a new
     function CropImageToTiles().  This new function returns either the
     new cropped image, or a list of tiles, according to geometry, without
@@ -33,7 +39,7 @@
 2011-03-27  6.6.8-10 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.8-10.
 
-2011-03-27 6.6.8-10 Anthony Thyssen <A.Thyssen@griffith...>
+2011-03-27  6.6.8-10 Anthony Thyssen <A.Thyssen@griffith...>
   * Modified image handling in MogrifyImages() and MogrifyImage()
     which improves overall handling, and allows correct %p, %n and the
     %[fx:..] 't' and 'n' escape usage to work correctly.
 2011-03-26  6.6.8-9 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.8-9.
 
-2011-03-25 6.6.8-9 Cristy  <quetzlzacatenango@image...>
+2011-03-25  6.6.8-9 Cristy  <quetzlzacatenango@image...>
   * Add InterpolateMagickPixelPacket() method.
   * Add support for the %[opaque] property.
 
 2011-03-25  6.6.8-8 Cristy  <quetzlzacatenango@image...>
   * New version 6.6.8-8.
 
-2011-03-25 6.6.8-8 Cristy  <quetzlzacatenango@image...>
+2011-03-25  6.6.8-8 Cristy  <quetzlzacatenango@image...>
   * Fix memory access bug in CloneString() (reference
     http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=18382).
   * Avoid infinite loop when no space is available in MagickFormatCaption().
 
-2011-03-25 6.6.8-8 Anthony Thyssen <A.Thyssen@griffith...>
+2011-03-25  6.6.8-8 Anthony Thyssen <A.Thyssen@griffith...>
   * Removed the fix for %p and %n escapes, as it was not working right
 
 2011-03-24  6.6.8-7 Cristy  <quetzlzacatenango@image...>
index 6b675aff6ed4035ffaf9b17408db7f9d908aac7c..bed1e05b4e43d45bce60c0cb814f132a2cf38838 100644 (file)
@@ -2289,6 +2289,34 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
           }
        }
     }
+
+#if 1
+
+  /* Set some properties for reporting by "identify" */
+      char
+        msg[MaxTextExtent];
+
+     /* encode ping_width, ping_height, ping_bit_depth, ping_color_type,
+        ping_interlace_method in value */
+
+     (void) FormatMagickString(msg,MaxTextExtent,"%d",(int) ping_width);
+     (void) SetImageProperty(image,"PNG:IHDR.width           ",msg);
+
+     (void) FormatMagickString(msg,MaxTextExtent,"%d",(int) ping_height);
+     (void) SetImageProperty(image,"PNG:IHDR.height          ",msg);
+
+     (void) FormatMagickString(msg,MaxTextExtent,"%d",(int) ping_bit_depth);
+     (void) SetImageProperty(image,"PNG:IHDR.bit_depth       ",msg);
+
+     (void) FormatMagickString(msg,MaxTextExtent,"%d",(int) ping_color_type);
+     (void) SetImageProperty(image,"PNG:IHDR.color_type      ",msg);
+
+     (void) FormatMagickString(msg,MaxTextExtent,"%d",
+        (int) ping_interlace_method);
+     (void) SetImageProperty(image,"PNG:IHDR.interlace_method",msg);
+
+#endif
+
   /*
     Read image scanlines.
   */
@@ -9657,6 +9685,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
 
       value=GetImageProperty(image,property);
       if (ping_exclude_pHYs != MagickFalse       ||
+          LocaleNCompare(property,"png:",4) != 0 ||
           LocaleCompare(property,"density") != 0 ||
           LocaleCompare(property,"units") != 0)
         {