[RESOVED] possible bug -white-threshold IM 6.8.5.6 Q16

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
User avatar
fmw42
Posts: 25982
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOVED] possible bug -white-threshold IM 6.8.5.6 Q16

Post by fmw42 »

White threshold does not seem to be working correctly to me. Black threshold seems fine


IM 6.8.1.9 both look correct

im6819 convert -size 256x256 gradient: -black-threshold 50% -level 50x100% -negate 1tmp1_6819.png
Image

im6819 convert -size 256x256 gradient: -white-threshold 50% -level 0x50% 1tmp2_6819.png
Image



IM 6.8.5.6 black-threshold look correct; white-threshold does not

convert -size 256x256 gradient: -black-threshold 50% -level 50x100% -negate 1tmp1_6856.png
Image


convert -size 256x256 gradient: -white-threshold 50% -level 0x50% 1tmp2_6856.png
Image



Here is a simpler test. There seems to be a nonlinear vs linear grayscale difference now compared to before.

6.8.1.9

im6819 convert -size 256x256 gradient: -black-threshold 50% 2tmp1_6819.png
Image

im6819 convert -size 256x256 gradient: -white-threshold 50% 2tmp2_6819.png
Image


6.8.5.6

convert -size 256x256 gradient: -black-threshold 50% 2tmp1_6856.png
Image

convert -size 256x256 gradient: -white-threshold 50% 2tmp2_6856.png
Image


If I create a linear gradient, then the latter test works fine. (As does the first test set at the top)

6.8.1.9

im6819 convert -size 256x256 gradient: -black-threshold 50% 3tmp1_6819.png
Image

im6819 convert -size 256x256 gradient: -white-threshold 50% 3tmp2_6819.png
Image


6.8.5.6

convert -size 256x256 gradient: -black-threshold 50% 3tmp1_6856.png
Image

convert -size 256x256 gradient: -white-threshold 50% 3tmp2_6856.png
Image


It is strange to me that for non-linear gradient (or grayscale image), -black-threshold works fine but -white-threshold does not in my first pair of examples above. Perhaps this is just colorspace management. But why did it change. I thought gradients were supposed have the same data content.
Last edited by fmw42 on 2013-05-25T18:48:32-07:00, edited 1 time in total.

User avatar
magick
Site Admin
Posts: 11133
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug -white-threshold IM 6.8.5.6 Q16 Mac OSX

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-8 Beta available by sometime tomorrow. Thanks.

User avatar
fmw42
Posts: 25982
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug -white-threshold IM 6.8.5.6 Q16 Mac OSX

Post by fmw42 »

Thanks. It is working fine in 6.8.5.8 Q16

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [RESOVED] possible bug -white-threshold IM 6.8.5.6 Q16

Post by anthony »

I don't see anything wrong with -white-threshold or -black-threshold


However it is irrevent to the original problem, are the threshold colors was not supposed to to be set to white or block, but clipped to the threshold level (a gray).

this in some ways is better.

Adding something like this would on the other hand do the job!
-evaluate max 30%
and
-evaluate min 30%

That is (for 'max') if color value is less that 30% set it to 30%, the larger of the two values.

Actually I ould not be suprised if that works NOW, as 'max' is a statistical function for -evaluate-sequence


And what do you know -- it works!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply