我想使用此代码从相机中下载一系列图像。但是下载速度很慢,如果我在幻灯片中查看它,我可以从图像序列中看到它并不流畅。有什么办法可以提高下载过程的速度?
for (int i = 0; i < 100; i++)
{
string ImagePath = Server.MapPath("\\CCTV_Files\\LogFile\\" + String.Format("{0:yyyyMMdd_hhmmss}", DateTime.Now) + ".jpg");
string ip = "http://IP.address.com:80/snapshot.cgi";
string sourceURL = ip;
WebRequest req = (WebRequest)WebRequest.Create(sourceURL);
req.Credentials = new NetworkCredential("usr", "pwd");
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
Bitmap bmp = (Bitmap)Bitmap.FromStream(stream);
bmp.Save(ImagePath);
}