Bug in png -depth option?

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
Petr_S
Posts: 1
Joined: 2011-03-12T18:45:06-07:00
Authentication code: 8675308

Bug in png -depth option?

Post by Petr_S » 2011-03-13T02:55:20-07:00

I'm using ImageMagick to combine matrix of 3x5 png files to one bigger using the following command:

Code: Select all

montage @a-001.txt -mode Concatenate -tile x5 -units PixelsPerInch -density 100 -depth 2 test.png
This command combines 15 input files with the following properties:

Code: Select all

test_11.png PNG 250x220 250x220+0+0 8-bit PseudoClass 4c 5.25KB 0.000u 0:00.000
Up to ImageMagick version 6.6.5-10 everything worked as expected and the output file had properties:

Code: Select all

test.png PNG 750x1100 750x1100+0+0 8-bit PseudoClass 4c 84.3KB 0.000u 0:00.000
Starting ImageMagick version 6.6.6.0 the properties remained the same, but the content (the picture) was garbled - stretched horizontally to 1/3 and filled with random vertical bars.

Code: Select all

test.png PNG 750x1100 750x1100+0+0 8-bit PseudoClass 4c 27.8KB 0.000u 0:00.000
This bug was corrected in ImageMagick version 6.6.7-10, but introduced a new one - the output is not 2 bit (4 colors) as requested, but 8-bit (256 colors) now and therefore bigger:

Code: Select all

test.png PNG 750x1100 750x1100+0+0 8-bit PseudoClass 256c 102KB 0.000u 0:00.000
This bug is here up to the latest version (6.6.8-4).

Is this really a bug or the same behavior can be achieved by a different command now? I've found nothing in the changelog.

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Bug in png -depth option?

Post by glennrp » 2011-03-13T12:47:27-07:00

PNG bit depths 2 and 4 are currently not supported.

I eliminated support for those depths (hopefully only temporarily) because they did
not work reliably.

You could try using PNG8 output which might produce a smaller file.

Otherwise, the only workaround that I know of is to do a final pass using ImageMagick-6.6.5.
I realize that is not a terribly satisfactory answer.

User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Bug in png -depth option?

Post by glennrp » 2011-05-20T05:52:12-07:00

Try ImageMagick-6.6.9-10, SVN revision r4475. The png encoder now respects the -depth option, even for depths 1, 2, and 4.

Post Reply