Bug in -threshold

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

Bug in -threshold

Post by fmw42 »

Documentation for -threshold on http://www.imagemagick.org/script/comma ... #threshold

says:

Create an image such that any pixel sample that is equal to, or exceeds the threshold, is reassigned the maximum intensity otherwise the minimum intensity.

To generate an all-black or all-white image with the same dimensions as the input image, you can use.

convert -threshold 65535 in.png black.png
convert -threshold 0,0 in.png white.png

but when I do either of the following, I see that the histogram shows

convert -size 256x256 gradient: -threshold 0 -format %c histogram:info:
65280: (65535,65535,65535, 0) #FFFFFFFFFFFF white
256: ( 0, 0, 0, 0) #000000000000 black

convert -size 256x256 gradient: -threshold 0,0,0 -format %c histogram:info:
65280: (65535,65535,65535, 0) #FFFFFFFFFFFF white
256: ( 0, 0, 0, 0) #000000000000 black

I was expecting to see no pixels at graylevel ( 0, 0, 0, 0)


The same with the following syntax

convert -threshold 0 -size 256x256 gradient: -format %c histogram:info:
65280: (65535,65535,65535, 0) #FFFFFFFFFFFF white
256: ( 0, 0, 0, 0) #000000000000 black

I am using 6.3.6.4 and perhaps this is fixed in 6.3.6.10?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug in -threshold

Post by magick »

There is patch for the problem you reported in ImageMagick 6.3.7-0 Beta available sometime tomorrow. Thanks.
User avatar
mi
Posts: 123
Joined: 2005-01-25T14:14:43-07:00
Contact:

Re: Bug in -threshold

Post by mi »

magick wrote:There is patch for the problem you reported in ImageMagick 6.3.7-0 Beta available sometime tomorrow. Thanks.
Could you post the patch here, please?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Bug in -threshold

Post by anthony »

This is NOT suposed to be a bug!!!!
and fixing the suposed bug interoduces a bug!

Read the option manual.

If you want to threshold everything you would use -threshold -1
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug in -threshold

Post by magick »

Patch reverted in ImageMagick 6.3.7-1 Beta.
Post Reply