Page 1 of 1

Change pixel color

Posted: 2015-06-05T01:57:20-07:00
by IvanShuvin
Please, help me. How to change pixel color on the image. I use the following code:

Code: Select all

            MagickImage img = new MagickImage(@"d:\TEST\110706M01000509.jpg");
            WritablePixelCollection pc = img.GetWritablePixels(100, 100, 50, 50);

            foreach (Pixel p in pc)
            {
                p.SetChannel(0, 255);
                p.SetChannel(1, 0);
                p.SetChannel(2, 0);
            }

            pc.Write();

            img.Write(@"d:\TEST\110706M01000509_.jpg");
But, on the output image the color of the pixels no red. Example: https://drive.google.com/file/d/0B66-Tt ... sp=sharing