Note that if you have a jpg then the colors probably aren't exactly what you expect. Two pixels right next to each other may have RGB values 128, 128, 128 and 127, 129, 130. They'll look the same to you but if you're looking for exact color values, they won't match.
I think you'll need to loop through the image and examine each pixel to see if it is close enough to the target value and, if it is, replace it with a new value. To decide whether it is "close enough," you may want to add up the absolute values of the differences in the R, G, B components. (You could square them, add, and take the square root to get a Euclidean distance in RGB space but just adding should work and will be quicker and easier.
Yes 256,0,0,0 is black and 256,256,256,256 is white.
|