0

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);
misha312
  • 1,443
  • 4
  • 18
  • 27

1 Answers1

0

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);
Kohanz
  • 1,510
  • 16
  • 35