When Bitmap object constructed from a file, the file remains locked for the lifetime of the object. So cannot modify image and save it back to the same file where it constructed.
Try like below
using (MemoryStream oStream = new MemoryStream())
{
using (FileStream fs = new FileStream(location, FileMode.Create, FileAccess.ReadWrite))
{
bitmap.Save(oStream , ImageFormat.Png);
byte[] bytes = oStream.ToArray();
fs.Write(bytes, 0, bytes.Length);
}
}
Hope this helps you...