c#将图片Image转换为内存流MemoryStream

HttpWebResponse resp = (HttpWebResponse)wRequest.GetResponse();
Stream stream = resp.GetResponseStream();
Image img = Image.FromStream(stream);
byte[] back = null;
MemoryStream memoryStream = new MemoryStream();
img.Save(memoryStream, ImageFormat.Jpeg);
back = memoryStream.GetBuffer();
string str = Convert.ToBase64String(back);

 

posted @ 2020-04-30 15:09  何以平天下  阅读(7363)  评论(0编辑  收藏  举报