-white-threshold seems to have been broken

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
Cliff

-white-threshold seems to have been broken

Post by Cliff »

I am using white-threshold to lose the background colours on images prior to posting them to a handwritten blog and suddenly there appears to have been a change in white-threshold.

Starting with this image and using ImageMagick 6.5.1-0 (the default with Ubuntu 9.10) I apply:

Code: Select all

convert patrick.png -white-threshold 75% patrick-6.5.1.png
and the image comes out as I would expect like this.

On the same machine, I installed ImageMagick 6.5.8-1 (which appears to be the latest version) and used:

Code: Select all

convert patrick.png -white-threshold 75% patrick-6.5.8.png
The resultant image now looks like this and I cannot see why.

Is this a bug with -white-threshold in 6.5.8? 6.5.4-7 (shipped with Fedora 12) does the same as 6.5.8-1 but there appears to be nothing in the changelog about a deliberate change to -white-threshold between 6.5.1 and 6.5.4.

Any help would be appreciated.

Thanks,
Cliff.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -white-threshold seems to have been broken

Post by magick »

We can reproduce the problem you posted and have a patch available tomorrow in ImageMagick 6.5.8-2 Beta. Thanks.
Cliff

Re: -white-threshold seems to have been broken

Post by Cliff »

magick wrote:We can reproduce the problem you posted and have a patch available tomorrow in ImageMagick 6.5.8-2 Beta. Thanks.
Wow, that was quick, thanks.

While you're fixing things, the PerlMagick functions WhiteThreshold and BlackThreshold need a channel argument added. At present there seems to be no way to set the channel from perl.

Thanks for the response
Cliff.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -white-threshold seems to have been broken

Post by magick »

PerlMagick's WhiteThreshold() has a channel parameter, its just undocumented. Look for a documentation patch by sometime tomorrow.
Cliff

Re: -white-threshold seems to have been broken

Post by Cliff »

magick wrote:PerlMagick's WhiteThreshold() has a channel parameter, its just undocumented.
Ah, that's interesting. I wonder why these give such different results?

Code: Select all

convert patrick.png -channel yellow  -white-threshold 60% +channel -white-threshold 78% - | display

Code: Select all

#!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;

my $img = new Image::Magick;

$img->Read('patrick.png');
$img->WhiteThreshold(channel => 'yellow', threshold => '60%');
$img->WhiteThreshold(threshold => '78%');

$img->display;
Cliff.
Cliff

Re: -white-threshold seems to have been broken

Post by Cliff »

Just picked up the latest trunk and I can confirm:
  • white-threshold works as expected
  • the perl and convert versions give similar results
Thank you very much for dealing with this so quickly. What an amazing service! You couldn't buy this level of support.

Thanks again,
Cliff.
Post Reply