After many frustrations with hair, I finally got one version of the PerlMagick module that works with my ActivePerl 5.10.0 build 1005. Now I play with it to make a very basic color change.
I can already replace one color, say black, with another, say blue, using the following code:
use strict;
use warnings;
use Image::Magick;
my $image = Image::Magick->new;
$image->Read('color-test.bmp');
$image->Opaque(fill => 'blue', color => 'black');
$image->Write('result.bmp');
But I am wondering if I can replace any color that is not black with blue. I hope and think that this requires some kind of idiomatic syntax, so I ask for urgent help :) Any ideas?
Thanks, as always, for any recommendations / suggestions / comments :)
UPDATE
@rjh, thank YOU for the code and information :) I tried them with small advertisements and they all work like a charm!
. PerlMagick - 6.5.4, :
use strict;
use warnings;
use Image::Magick;
my $image = Image::Magick->new;
$image->Read('color-test.bmp');
$image->Transparent(color=>'black');
$image->Colorize(fill=>'blue');
$image->Composite(image=>$image);
$image->Write('result.bmp');
, , . . , , -:)
, .
!