From: glennrp Date: Fri, 17 Jan 2014 16:08:31 +0000 (+0000) Subject: Added "-define png:swap-bytes" option. X-Git-Tag: 7.0.1-0~2843 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d767725a26a52a3c8362cbb1b88cbe0fd52522d;p=imagemagick Added "-define png:swap-bytes" option. --- 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