Page 1 of 1

-white-threshold seems to have been broken

Posted: 2009-11-28T10:51:54-07:00
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.

Re: -white-threshold seems to have been broken

Posted: 2009-11-28T12:30:32-07:00
by magick
We can reproduce the problem you posted and have a patch available tomorrow in ImageMagick 6.5.8-2 Beta. Thanks.

Re: -white-threshold seems to have been broken

Posted: 2009-11-28T13:17:29-07:00
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.

Re: -white-threshold seems to have been broken

Posted: 2009-11-28T13:51:28-07:00
by magick
PerlMagick's WhiteThreshold() has a channel parameter, its just undocumented. Look for a documentation patch by sometime tomorrow.

Re: -white-threshold seems to have been broken

Posted: 2009-11-28T14:12:20-07:00
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.

Re: -white-threshold seems to have been broken

Posted: 2009-11-28T16:35:09-07:00
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.