Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Setting RGB color values of an image

$
0
0
I tried the following code but WritablePixelCollection Write() is not updating the image at all
Also i tried writing the image to physical drive again but not working
using (MagickImage image = new MagickImage(@"E:\Development\DOTNET\PCXEditor\RGBEditor\18975253ee.pcx"))
        {

                WritablePixelCollection p = image.GetWritablePixels();
                foreach (Pixel pp in p)
                {

                    Pixel pc = new Pixel(1, 1, 4);

                    Color c = pp.ToColor();
                    if (c.R == 128)
                        //r = 100;

                        pc.SetChannel(0, 100);

                    if (c.G == 118)
                        //g = 105;
                        pc.SetChannel(1, 105);
                    if (c.B == 118)
                        //b = 110;
                        pc.SetChannel(2, 110);

                    p.Set(pc);


                    //pc = null;
                }

                MessageBox.Show(p.GetPixel(1, 1).ToColor().R.ToString());   // the value has changed already still here its fine
                p.Write(); // this is not working

                  // image.Write(@"E:\Development\DOTNET\PCXEditor\RGBEditor\1897525311-changed.pcx");

        }

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>