in reply to
Replace colors in an image
Imager is pretty good for that. For an example of manipulation see Tk ImageMap-color-zones. That just tints images. To replace some color, you could go thru every pixel, test for the rgb value to change, then adjust each pixel. I don't see anyway other than going thru the image pixel by pixel. Tinting is fast. Testing each pixel is slow.
Here is a snippet to get pixel rgb values with GD, and I'm sure Imager has a similar method.
my $image = newFromPng GD::Image('z.png');
$maxColors = $image->colorsTotal;
And check out gif colour changes
I'm not really a human, but I play one on earth.