title: Error : A generic error occurred in GDI+. while saving Image
body: <p>While i am trying to save Image getting this error
  <code>A generic error occurred in GDI+</code>
   I searched for this error and checked write permissions for this folder ,and also checked that image file is not in use by anything else (including my code) But While I am trying to save Image still getting same error,Where is the mistake </p>
  
  <pre><code>public partial class AdsMaster : Form
      {
          OpenFileDialog ofd=null;
          public AdsMaster()
          {
              InitializeComponent();
          }
  
      private void browseButton_Click(object sender, EventArgs e)
      {
          ofd = new OpenFileDialog();
          ofd.Filter = "image files|*.jpg;*.jpeg;*.gif;*.png;*.bmp";
          DialogResult dr = new DialogResult();
          if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
          {
              Image img = new Bitmap(ofd.FileName);//create the bitmap
              string imgName = ofd.SafeFileName;
              txtImagePath.Text = imgName;
              pictureBox1.Image = img.GetThumbnailImage(350, 350, null, new IntPtr());
              ofd.RestoreDirectory = true;
              img.Dispose();
          }
      }
  
      private void saveImage_Click(object sender, EventArgs e)
      {
          String str = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
          string path = str + "\\Image\\";
          Image img = new Bitmap(ofd.FileName);
          string imgName = ofd.SafeFileName;
          try
          {
                 img.Save(path + imgName); //getting error at this line 
                 MessageBox.Show("Image is saved");
                 img.Dispose();  // dispose of your image                   
          }
          catch(Exception err)
          {
              MessageBox.Show(err.Message.ToString());
          }
  
        }        
  } 
  </code></pre>