The Imager module has some good tools for this. For example check out
batch rgb brightness and contrast adjustment. That script shows tinting, but you can probably find a way to replace just one color. Look thru the perldocs for Imager, there may be an example in there. I would think as a last resort, you could unpack the jpg to rgb values, then use a substitution regex on the color you want changed, then pack it back to binary.
I'm not really a human, but I play one on earth.
flash japh