1、Bitmap的保存像素到bmp图片文件(1)纯像素数组拷贝;2)图片格式读取到有格式的流再拷贝到另一个Bitmap)
1)Rectangle rect = new Rectangle(0, 0, xtCamaraConnect.PixelWidth, xtCamaraConnect.PixelHeight);
Bitmap bitmap = new Bitmap(xtCamaraConnect.PixelWidth, xtCamaraConnect.PixelHeight,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
System.Drawing.Imaging.BitmapData data = bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmap.PixelFormat);
Marshal.Copy(ColorData, 0, data.Scan0, ColorData.Length );
bitmap.UnlockBits(data);
bitmap.Save("cccc.bmp" );
2)byte[] aa = new byte[100*100*4];
//Buffer.BlockCopy( ColorData, 0, aa, 0, ColorData.Length*4);
stream = new System.IO.MemoryStream(aa);
Bitmap image = (Bitmap)Image.FromFile("未命名.bmp");//.FromStream(stream);
image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
Bitmap image2 = (Bitmap)Image.FromStream(stream);
image.Save("sss.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bb = stream.ToArray();
Console.WriteLine(bb[0] + " " + bb[1] + " " + bb[2] + " " + bb[3]);
2)c# 解析JSON的几种办法 (JavaScriptSerializer要用Net.4.0 不是Client Profile) http://www.cnblogs.com/ambar/archive/2010/07/13/parse-json-via-csharp.html