Parameter is not valid exception when saving image in winform
<p>I am getting a parameter is not valid exception..While saving the image</p>

<p>Here is my code to save the image</p>

<pre><code>if (!File.Exists(pictureBox1.Tag.ToString()))
{
    Image image = pictureBox1.Image;
    image.Save(pictureBox1.Tag.ToString(), ImageFormat.Jpeg);
}
else
{
    string delStr = pictureBox1.Tag.ToString();
    pictureBox1.Image.Dispose();
    File.Delete(delStr);
    Image image = pictureBox1.Image;
    image.Save(delStr, ImageFormat.Jpeg);
    pictureBox1.Image = Image.FromFile(delStr);
}
</code></pre>
