Quick and dirty solution. Run the image pixel by pixel, if the color change, just paint the pixel red.
PS: Notice this may not work for a square, unless you do the same vertically and horizontally
What you are looking for is edge detection. You can find a number of resources for the general algorithm on Google:
i can at least point you in the direction of some pretty neat edge detection filters: http://www.codeproject.com/KB/GDI-plus/edge_detection.aspx
i imagine it should suit you quite well
Never had to do anything like this, but a powerful tool for complex image manipulation is:
http://www.imagemagick.org/script/index.php
Lots of documentation and examples -- and a .NET wrapper if you'd rather not call the executable.
Interesting problem - I'm assuming the 'white circle' in your example is actually another image - meaning you aren't drawing the circle yourself?
If so, you might scan through all of the pixels to find a white pixel that has black on at least one side of it (either 4 directions or 8 including corners). If it is a match then swap it to red. If not then ignore it.
I doubt that is the best way to do it, but if it is only black and white, this might get you started.
There is several approach for this.
The first one is: - you know that there is a circle, and you juste need to find where is the center and how is the radius. So you can use Hough transformation to find these, and them draw your circle in red. Read this topic or this one
The 2nd is to use edge detection. Here or here (here for more theoritical point of view)
Ultimately you want to edit the pixels of the image. That question has already been answered here by Marc Gravell.
Then, based on which option you choose, either LockBits or GetPixel/SetPixel, you will need to loop through and look at the per pixel color values. Keep looping until you hit a white pixel.
Once you do, check in all directions around it, if you find a black pixel, then color that white pixel red. This is of course the most simplistic answer, and there are ways to optimize it, but it will work.
For instance, if you wanted to limit the color changing to just the four directly adjacent pixels, you could, rather than also checking the diagonals.