图片转换成流

时间:2024-01-30 07:50:14

Image image = Image.FromFile(@"C:\Users\swkj\Documents\Visual Studio 2012\Projects\WebApplication9\WindowsFormsApplication1\ali.jpg");//这是你图片文件的
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Bmp); //把图片保存到流中。
byte[] b = stream.ToArray();
string i = string.Empty;
//foreach (var a in b)
//{
// i += a;
//}
string a = Convert.ToBase64String(b);  //base64加密