下载图片

        string url = "https://";

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.ServicePoint.Expect100Continue = false;
            req.Method = "GET";
            req.KeepAlive = true;
            req.ContentType = "image/*";
            HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
            System.IO.Stream stream = null;
            try
            {
                stream = rsp.GetResponseStream();
                System.Drawing.Image.FromStream(stream);
            }
            finally
            {
                if (stream != null) stream.Close();
                if (rsp != null) rsp.Close();
            } 

使用HttpWebRequest下载,System.Drawing.Image.FromStream()生成图片。

原文地址:https://www.cnblogs.com/tingqianzhu/p/8513498.html