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:
possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
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)
and this... (WORKS)
The same goes for this 'sRGB to linear RGB' conversion (WORKS)
Threshold should be on 'values' and not have any colorspace dependencies. It is highly mathematical.
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:
Code: Select all
convert -size 100x100 gradient:'gray(0)-gray(100%)' -set colorspace RGB -threshold 50% -colorspace sRGB show:
Code: Select all
convert -size 100x100 gradient: -set colorspace RGB -threshold 50% -colorspace sRGB show:
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
I would hope the results of the following would be the same:
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.
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
Another difference: g4.png has the gamma "1", where all the others have gamma 0.4545.
snibgo's IM pages: im.snibgo.com
Re: possible bug gradient: -threshold IM 6.8.5.4 Q16 Mac OSX
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-5 Beta available by sometime tomorrow. Thanks.