Page 1 of 1

png:compression-filter=0 is broken [patch included]

Posted: 2014-07-08T12:21:02-07:00
by njdoyle
The following command ignores the valid convert option -define png:compression-filter=0

Code: Select all

$ convert logo: -define png:compression-filter=0 PNG:- > /dev/null
convert: ignoring invalid defined png:compression-filter =0 @ warning/png.c/WritePNGImage/12024.
Seems there was a forgotten 'else' in png.c between the options 0 and 2 for reading the png compression filter option.

Here's the patch against ImageMagick-6.8.9-5:

Code: Select all

diff -rupN ImageMagick-6.8.9-5.old/coders/png.c ImageMagick-6.8.9-5/coders/png.c
--- ImageMagick-6.8.9-5.old/coders/png.c	2014-06-29 22:48:13.000000000 -0400
+++ ImageMagick-6.8.9-5/coders/png.c	2014-07-08 13:23:30.000000000 -0400
@@ -12003,7 +12003,7 @@ static MagickBooleanType WritePNGImage(c
       if (LocaleCompare(value,"0") == 0)
         mng_info->write_png_compression_filter = 1;
 
-      if (LocaleCompare(value,"1") == 0)
+      else if (LocaleCompare(value,"1") == 0)
         mng_info->write_png_compression_filter = 2;
 
       else if (LocaleCompare(value,"2") == 0)

Re: png:compression-filter=0 is broken [patch included]

Posted: 2014-07-08T12:29:55-07:00
by dlemstra
Thank you very much. Your patch has been applied and this will be fixed in the next release of ImageMagick (6.8.9-6)