//byte[] 转图片
public static Bitmap BytesToBitmap(byte[] Bytes)
{
MemoryStream stream= null;try{
stream= newMemoryStream(Bytes);return new Bitmap((Image)newBitmap(stream));
}catch(ArgumentNullException ex)
{throwex;
}catch(ArgumentException ex)
{throwex;
}finally{
stream.Close();
}
}//图片转byte[]
public static byte[] BitmapToBytes(Bitmap Bitmap)
{
MemoryStream ms= null;try{
ms= newMemoryStream();
Bitmap.Save(ms, Bitmap.RawFormat);byte[] byteImage = newByte[ms.Length];
byteImage=ms.ToArray();returnbyteImage;
}catch(ArgumentNullException ex)
{throwex;
}finally{
ms.Close();
}
}
}==================