using System.IO;
using System.Drawing.Imaging;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
-------------------------------------导包---------------------------
MemoryStream ms = new MemoryStream(); //创建一个内存流
image.Save(ms, ImageFormat.Jpeg); //把图片保存在内存流里面,格式为Jpeg格式
ms.Flush(); //关闭内存流
byte[] b=ms.GetBuffer(); //直接获得2进制byte数组
//b就是这个图片的字节流
System.IO.MemoryStream s = new MemoryStream(字节数组);
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(s);
bitmap.Save(filename);