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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
njdoyle
Posts: 8
Joined: 2014-07-08T12:12:20-07:00
Authentication code: 6789
Location: Ottawa, Ontario

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

Post by njdoyle » 2014-07-08T12:21:02-07:00

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)

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra » 2014-07-08T12:29:55-07:00

Thank you very much. Your patch has been applied and this will be fixed in the next release of ImageMagick (6.8.9-6)
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply