Page 1 of 1

bug in -black-threshold & -white-threshold vs documentation

Posted: 2009-09-16T19:27:30-07:00
by fmw42
The options page documentation for -black-threshold says:

"Force to black all pixels at or below the threshold while leaving all pixels above the threshold unchanged."

And for -white-threshold says:

"Force to white all pixels at or above the threshold."

But the code says for -black-threshold:

if ((MagickRealType) q->red < threshold.red)
q->red=(Quantum) 0;

And for -white-threshold:

if (((channel & RedChannel) != 0) &&
((MagickRealType) q->red > threshold.red))
q->red=(Quantum) QuantumRange;

So the documentation says that the black-point and white-point are inclusive of what is changed to black or white, but the code says that it they are exclusive.

If the options page documentation is indeed wrong, let me know and I will go ahead and fix it.

Re: bug in -black-threshold & -white-threshold vs documentation

Posted: 2009-09-17T05:49:41-07:00
by magick
The documentation is wrong. The black threshold for example, is documented in the code as
BlackThresholdImage() is like ThresholdImage() but forces all pixels below
the threshold into black while leaving all pixels at or above the threshold
unchanged.
Notice it says below the threshold. Feel free to correct the HTML docs.

Re: bug in -black-threshold & -white-threshold vs documentation

Posted: 2009-09-17T10:03:06-07:00
by fmw42
No problem. I will then just correct the docs at http://www.imagemagick.org/script/comma ... ptions.php. On further thought, I think it best not to have a loss of backward compatibility. I can deal with the offset in my script easy enough.

Fred