C# &引用;GDI+;中发生一般性错误&引用;在Windows XP的浏览器中显示图像时出错
在浏览器中显示C# &引用;GDI+;中发生一般性错误&引用;在Windows XP的浏览器中显示图像时出错,c#,asp.net,image,tiff,C#,Asp.net,Image,Tiff,在浏览器中显示.tiff图像时出现以下错误 A generic error occurred in GDI+. 我正在将.tiff图像转换为.png,然后在浏览器中显示它们 A generic error occurred in GDI+. 我的代码: Response.ContentType = "image/png"; Response.AddHeader("content-disposition", "filename=" + Request.QueryString["path"]);
.tiff
图像时出现以下错误
A generic error occurred in GDI+.
我正在将.tiff
图像转换为.png
,然后在浏览器中显示它们
A generic error occurred in GDI+.
我的代码:
Response.ContentType = "image/png";
Response.AddHeader("content-disposition", "filename=" + Request.QueryString["path"]);
Image img = Image.FromFile(Request.QueryString["path"]);
img.Save(Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
但是,此错误仅在Windows XP中出现。同样的代码在Windows 7中也可以正常工作。尝试使用位图进行转换
System.Drawing.
Bitmap.FromFile(Request.QueryString["path"])
.Save(Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
参考: