0

I am getting following error while showing .tiff images in a browser.

A generic error occurred in GDI+.

I am converting .tiff images to .png and then displaying them in a browser.

My code:

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);

However this error only comes up in Windows XP. The same code is works fine in Windows 7.

Aaron
  • 1,956
  • 5
  • 34
  • 56
Amol Kolekar
  • 2,307
  • 5
  • 30
  • 45

1 Answers1

0

Try to convert it using the BitMap

System.Drawing.
 Bitmap.FromFile(Request.QueryString["path"])
  .Save(Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);

reference :

Converting TIFF files to PNG in .Net

http://bytes.com/topic/c-sharp/answers/267798-convert-tiff-images-gif-jpeg

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150