Page 1 of 1
-type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T12:00:34-07:00
by Uma
Hello,
I've noticed a quite annoying bug as it took me some time to know where it came from.
When you try to convert a png image with -type bilevel, it fails sometimes.
By fail I mean the result is a fully black image.
Note that on the version 6.6.9-7 it works normally.
Here's one image that fails for you to test.
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T12:32:47-07:00
by fmw42
I can duplicate the bug on IM 6.8.7.4 Q16 Mac OSX
convert 4d0y.png -type bilevel show:
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T13:26:39-07:00
by glennrp
I'm seeing the problem as well. Something's wrong when using -type bilevel to reduce the image to 2-colors,
without telling the PNG encoder how to do the reduction.
These work, with or without -type bilevel as the final option:
Code: Select all
convert 4d0y.png -colorspace gray -ordered-dither 2x2 4d0y-od2x2.png
convert 4d0y.png -colorspace gray -threshold 50% 4d0y-threshold50.png
Also, the "-colorspace gray" can be omitted from the one using -threshold (but it is
required with the -ordered-dither).
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T13:34:30-07:00
by glennrp
Apparently 4d0y.png was originally a JPEG, converted by ImageMagick,
because it contains these text chunks, according to "pngcrush -n -v 4d0y.png":
- Handling 4 tEXt/zTXt/iTXt chunks after IDAT
0 date:create: 2013-10-31T16:26:29+01:00
1 date:modify: 2013-10-31T16:26:29+01:00
2 jpeg:colorspace: 2
3 jpeg:sampling-factor: 2x2,1x1,1x1
I tried removing them just in case the jpeg properties were causing trouble somehow,
but that didn't change the behavior.
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T13:55:16-07:00
by glennrp
converting to PPM results in the same full-color image.
converting to PPM with -type bilevel results in an all-black image.
It appears that the reduction to black happens somewhere other than
in coders/png.c.
The error does not occur with IM-6.8.7-3 so it's a new bug.
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T17:16:12-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.7-5 Beta available by sometime tomorrow. Thanks.
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-05T18:56:58-07:00
by glennrp
Svn revision 13682 (tomorrow's 6.8.7-5) works for me. Thanks.
Re: -type bilevel fails on some PNG - IM 6.8.7-4
Posted: 2013-11-06T07:30:06-07:00
by Uma
Thanks for the fix guys !
It worked for all of my images !
Another question though : are you in charge of imagemagick-common libmagickcore5 and libmagickwand5 ?
Because I'm actually using wand as an api for python and it's still the same problem over here.
Do you have to update the libraries or they do not belong to you ?