Your code works if you have to replace a perfectly white color (R=255, G=255, B=255 or #ffffff if you prefer).
If you are trying to replace a color that is similar (but not exactly equal) to white you can use ColorFuzz
to introduce a tolerance.
To achieve this you can add a new fuzz
parameter to your method that should look like this:
private static MagickImage ChangeWhiteColor(MagickImage Image, Color TargetColor, int fuzz)
{
Image.ColorFuzz = new Percentage(fuzz);
Image.Opaque(MagickColor.FromRgb((byte)255, (byte)255, (byte)255),
MagickColor.FromRgb(TargetColor.R,
TargetColor.G,
TargetColor.B));
return Image;
}
Consider for example the following image that contains three white rectangles. Under each shape I reported the RGB values. The first rectangle on the left is filled with pure white color, while the second and the third are filled with very light greys that are very similar to the white color:

Your original code will only replace the first white rectangle on the left (since fuzz default value is 0%):

Running the modified code with fuzz=2
will replace the first and the second white rectangle, but not the third:

Running the modified code with fuzz=6
will replace all the three white rectangles:

You can adjust fuzz
value (percentage) in order to match the colors you have to replace.
More info about fuzz here.