replace_color - replace one color with another in an image
perl replace_color fromcolor tocolor inimage outimage
This is a simple demonstration of Imager::transform2 that replaces one color with another in an image.
Note: this works with full color images, and always produces a 3 channel output image - the alpha channel (if any) is not preserved.
Most of the work is done in the replace_color() function.
Called:
my $result = replace_color($in_image, $from_color, $to_color);
Returns a new image object with colors replaced.
$Revision: 816 $
Tony Cook <tony@develop-help.com>
Imager, Imager::Engines, Imager::Color, Imager::Files
To install Imager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Imager
CPAN shell
perl -MCPAN -e shell install Imager
For more information on module installation, please visit the detailed CPAN module installation guide.