From 0d767725a26a52a3c8362cbb1b88cbe0fd52522d Mon Sep 17 00:00:00 2001
From: glennrp <glennrp@git.imagemagick.org>
Date: Fri, 17 Jan 2014 16:08:31 +0000
Subject: [PATCH] Added "-define png:swap-bytes" option.

---
 coders/png.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/coders/png.c b/coders/png.c
index a00e4a322..e27f0a706 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -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
-- 
2.40.0