尝试保存位图时出错

时间:2014-02-15 09:44:51

标签: c# bitmap stream httpwebrequest webrequest

当我尝试保存this image时,它会给我错误

  

GDI +中发生了一般错误

完整保存路径为C:\Users\BLUE\Documents\Visual Studio 2013\Projects\ModaelinizdeZoomİmage\ModaelinizdeZoomİmage\bin\Debug\DVKZM237735\2854_buyuk_zoom.jpg

array [1] = DVKZM237735

我的代码:

WebRequest req;
req = WebRequest.Create(et.GetAttribute("src"));

using (var imagestream = req.GetResponse().GetResponseStream())
{
   using (var img = Image.FromStream(imagestream))
   {
      var bmp = new Bitmap(img);
      bmp.Save(array[1] + "\\" + Path.GetFileName(et.GetAttribute("src")));//Error
   }
}

由于

1 个答案:

答案 0 :(得分:0)

好像你已经过度简化了保存流,看看接受的答案on this other SO post