Page 1 of 1
possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
Posted: 2013-05-05T23:05:09-07:00
by fmw42
Is this a bug or just a color management issue?
This does not produce and 50-50 black and white image
convert -size 256x256 gradient: -threshold 50% show:
But this does
convert -size 256x256 gradient: -set colorspace RGB -threshold 50% show:
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
Posted: 2013-05-05T23:12:56-07:00
by anthony
I would have expected the first to be correct. threshold in sRGB colorspace.
I would also expect this to produce a 50-50% in linear grayscale colorspace (
FAILS)
Code: Select all
convert -size 100x100 gradient:'gray(0)-gray(100%)' -threshold 50% -colorspace sRGB show:
and this... (WORKS)
Code: Select all
convert -size 100x100 gradient:'gray(0)-gray(100%)' -set colorspace RGB -threshold 50% -colorspace sRGB show:
The same goes for this 'sRGB to linear RGB' conversion (WORKS)
Code: Select all
convert -size 100x100 gradient: -set colorspace RGB -threshold 50% -colorspace sRGB show:
Threshold should be on 'values' and not have any colorspace dependencies. It is highly mathematical.
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
Posted: 2013-05-06T00:00:09-07:00
by fmw42
Yes, I did all those tests, too. I was surprised by the failures, also. I did not show them as I was trying to keep the test cases as simple as possible.
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
Posted: 2013-05-06T05:17:19-07:00
by snibgo
I would hope the results of the following would be the same:
Code: Select all
"%IM%convert" -size 100x100 gradient: %cs1% -threshold 50%% g1.png
"%IM%convert" -size 100x100 gradient: %cs1% -level 50%%,50%% g2.png
"%IM%convert" -size 100x100 gradient: %cs1% -level-colors gray(50%%),gray(50%%) g3.png
"%IM%convert" -size 100x100 gradient: %cs1% -contrast-stretch 50%%,50%% g4.png
"%IM%convert" xc:Black xc:White -append bwmap.png
"%IM%convert" -size 100x100 gradient: +dither -remap bwmap.png g5.png
For IM v6.8.5-0 in Windows they are visually the same, except for threshold.
Another difference: g4.png has the gamma "1", where all the others have gamma 0.4545.
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
Posted: 2013-05-06T07:11:59-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-5 Beta available by sometime tomorrow. Thanks.