GetThumbnail() not working



Presentation pres = new Presentation(Server.MapPath(".") + "/test.ppt");

foreach (Slide s in pres.Slides)
{
System.Drawing.Image img = s.GetThumbnail(2,2);
string strSavePath = Server.MapPath(".") + "\\slide" + s.SlidePosition.ToString() + ".jpg";
img.Save(strSavePath, img.RawFormat);
GC.Collect();
}



on the img.Save() line, I keep getting "A generic GDI+ error has occured." Any ideas as to how to fix this?

Dear Michael,

Google has some solutions…
1. Image.Save is not thread safe.
2. Try to cast Image to Bitmap and after that save it.