Selective colour replacement is easy from the command line with imagemagick.
You can download imagemagick from http://www.imagemagick.org/
The following will replace all red (#FF0000) pixels with blue (#0000FF)
convert sourceimage.png -fill "#FF0000" -opaque "#0000FF" destimage.png |