🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / C# DEVEXPRESS RMOS / image rgb yapma

1-) C# DEVEXPRESS RMOS - image rgb yapma

 

 

 //image path

            string img = @"C:\Users\ramazan\Desktop\resmim.jpg";

 

            //read image

            Bitmap bmp = new Bitmap(img);

 

            //load original image in picturebox1

            pictureBox1.Image = Image.FromFile(img);

 

            //get image dimension

            int width = bmp.Width;

            int height = bmp.Height;

 

            //3 bitmap for red green blue image

            Bitmap rbmp = new Bitmap(bmp);

            Bitmap gbmp = new Bitmap(bmp);

            Bitmap bbmp = new Bitmap(bmp);

 

            //red green blue image

            for (int y = 0; y < height; y++)

            {

                for (int x = 0; x < width; x++)

                {

                    //get pixel value

                    Color p = bmp.GetPixel(x, y);

 

                    //extract ARGB value from p

                    int a = p.A;

                    int r = p.R;

                    int g = p.G;

                    int b = p.B;

 

                    //set red image pixel

                    rbmp.SetPixel(x, y, Color.FromArgb(a, r, 0, 0));

 

                    //set green image pixel

                    gbmp.SetPixel(x, y, Color.FromArgb(a, 0, g, 0));

 

                    //set blue image pixel

                    bbmp.SetPixel(x, y, Color.FromArgb(a, 0, 0, b));

 

                }

            }

 

            //load red image in picturebox2

            pictureBox2.Image = rbmp;

 

            //load green image in picturebox3

            pictureBox3.Image = gbmp;

 

            //load blue image in picturebox4

            pictureBox4.Image = bbmp;

 

            //write (save) red image

            rbmp.Save(@"C:\Users\ramazan\Desktop\Red.png");

 

            //write(save) green image

            gbmp.Save(@"C:\Users\ramazan\Desktop\Green.png");

 

            //write (save) blue image

            bbmp.Save(@"C:\Users\ramazan\Desktop\Blue.png");

 2021 Ocak 18 Pazartesi
 542