Question

I want to create a program that saves a bmp file to my pictures\test. Because of some unknown reason I get -" A generic error occurred in GDI+." Please help me understand why this is happening to me. My code is:

System.Drawing.Image img = Properties.Resources.pic;
        string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
        string path2 = path+@"\"+"test";
        img.Save(path2, System.Drawing.Imaging.ImageFormat.Bmp);

No correct solution

OTHER TIPS

Could be any number of things, but try saving a copy of the image:

System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Properties.Resources.pic);
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
string path2 = path+@"\"+"test";
bmp.Save(path2);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top