获取图片指定的RGB值可以使用C#中的System.Drawing命名空间下的Bitmap类来实现,代码示例如下所示(假设需要获取图片中坐标为(100, 200)的像素点的RGB值):
using System.Drawing;
// 首先加载图片
Bitmap bitmap = new Bitmap("image.jpg");
// 获取指定位置的像素点RGB值
Color color = bitmap.GetPixel(100, 200);
int red = color.R;
int green = color.G;
int blue = color.B;如在winform 中的操作为:
            Bitmap bmp = (Bitmap)zpic.Image;
            try
            {
                Color pointColor = bmp.GetPixel(e.X, e.Y);
                ztxtr.Text = pointColor.R.ToString();
                ztxtg.Text = pointColor.G.ToString();
                ztxtb.Text = pointColor.B.ToString();
                ztxtHex.Text = FormatColorHex(pointColor);
            }
            catch { }效果如下:



 
             
        