PNG re-work: save png_bits and png_interlace tags
authorTony Cook <tony@develop-help.com>
Mon, 7 Nov 2011 09:11:18 +0000 (20:11 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 29 Apr 2012 03:40:55 +0000 (13:40 +1000)
PNG/impng.c

index a42c3d2..55e9bef 100644 (file)
@@ -371,6 +371,20 @@ get_png_tags(i_img *im, png_structp png_ptr, png_infop info_ptr) {
       i_tags_setn(&im->tags, "i_aspect_only", 1);
     }
   }
+  switch (png_get_interlace_type(png_ptr, info_ptr)) {
+  case PNG_INTERLACE_NONE:
+    i_tags_setn(&im->tags, "png_interlace", 0);
+    break;
+  case PNG_INTERLACE_ADAM7:
+    i_tags_set(&im->tags, "png_interlace", "adam7", -1);
+    break;
+
+  default:
+    i_tags_set(&im->tags, "png_interlace", "unknown", -1);
+    break;
+  }
+
+  i_tags_setn(&im->tags, "png_bits", png_get_bit_depth(png_ptr, info_ptr));
 }
 
 static void