I am trying to watermark a jpg image with another jpg image. It's working fine if I store the resulting image as a new image. Is it possible to just update the original image file with the watermark image? I don't need to store it as a different file.
Here is my code:
//watermark image
Bitmap sizedImg = (Bitmap)System.Drawing.Image.FromFile(@"C:\report branding.jpg");
//original file
System.Drawing.Bitmap template=(System.Drawing.Bitmap)System.Drawing.Image.FromFile(@"C:\CentralUtahCombined1.jpg");
Graphics g = Graphics.FromImage(template);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.DrawImage(sizedImg, new Point(template.Width - sizedImg.Width,
template.Height - sizedImg.Height));
//watermarking the image but saving it as a different image file - here if I //provide the name as the original file name, it throws an error
string myFilename = @"C:\CentralUtah.jpg";
template.Save(myFilename);
template.Dispose();
sizedImg.Dispose();
g.Flush();