c# 获取图片像素的RGB值

 

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;
            using (Bitmap bmp = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "werty.png"))
            {
                Color pixelColor = bmp.GetPixel(x, y);

                //像素点颜色的 Alpha 值
                byte alpha = pixelColor.A;
                //颜色的 RED 分量值
                byte red = pixelColor.R;
                //颜色的 GREEN 分量值
                byte green = pixelColor.G;
                //颜色的 BLUE 分量值
                byte blue = pixelColor.B;

               }
           
        }

你可能感兴趣的:(c#,byte,object)