http://blog.csdn.net/zh_geo/article/details/46239439
-
- Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
- BitmapData bmpData = image.LockBits(rect, ImageLockMode.ReadWrite, image.PixelFormat);
-
- IntPtr ptr = bmpData.Scan0;
-
- int bytes = Math.Abs(bmpData.Stride) * image.Height;
- byte[] rgbValues = new byte[bytes];
-
- Marshal.Copy(ptr, rgbValues, 0, bytes);
-
- image.UnlockBits(bmpData);
- return rgbValues;