从webClient响应中获取图像宽度和高度

时间:2015-03-24 10:43:48

标签: c# webrequest

我想获得图像尺寸(宽度和高度)

Example logo

var source = "http://c.s-microsoft.com/en-us/CMSImages/mslogo.png?version=856673f8-e6be-0476-6669-d5bf2300391d";
WebClient client = new WebClient();
client.OpenRead(source);

1 个答案:

答案 0 :(得分:0)

WebRequest request = WebRequest.Create(source);
WebResponse response = request.GetResponse();
Image image = Image.FromStream(response.GetResponseStream());