]> granicus.if.org Git - imagemagick/commitdiff
Added "-define png:swap-bytes" option.
authorglennrp <glennrp@git.imagemagick.org>
Fri, 17 Jan 2014 16:08:31 +0000 (16:08 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Fri, 17 Jan 2014 16:08:31 +0000 (16:08 +0000)
coders/png.c

index a00e4a322d20de1e4a50fed87aba928e987a6a71..e27f0a706607df92ecb019a4ea775c6436c48a38 100644 (file)
@@ -2461,6 +2461,25 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
   ping_file_depth = ping_bit_depth;
 
+  /* Swap bytes if requested */
+  if (ping_file_depth == 16)
+  {
+     const char
+       *property;
+
+     ResetImagePropertyIterator(image);
+
+     while (property != (const char *) NULL)
+       {
+         GetImageProperty(image,property,exception);
+
+         if (LocaleNCompare(property,"png:swap-bytes",14) != 0)
+           png_set_swap(ping);
+
+         property=GetNextImageProperty(image);
+       }
+  }
+
   /* Save bit-depth and color-type in case we later want to write a PNG00 */
   {
       char