Page 1 of 1

Cannot replace color

Posted: 2017-03-09T09:42:41-07:00
by Verlemion
Hello, I'm trying to replace white color to green using this code:

Code: Select all

private static MagickImage ChangeWhiteColor(MagickImage Image, Color TargetColor)
        {
            MagickImage NewImage = new MagickImage(Image);

            NewImage.Opaque(MagickColor.FromRgb(255, (byte)255, (byte)255), 
                MagickColor.FromRgb(TargetColor.R,
                TargetColor.G,
                TargetColor.B));

            return NewImage;
        }
But it seems that code won't work, it just replaces color to light gray. What I should do?

Re: Cannot replace color

Posted: 2017-03-11T19:15:01-07:00
by dlemstra
Which version are you using? And what is the value of your TargetColor.