title: Automatically add watermark to an image
body: <p>while searching for a solution to automatically put a watermark to an image in internet, i found a best solution in stackoverflow.  Link for the question is <a href="https://stackoverflow.com/questions/4113900/c-sharp-add-watermark-to-the-photo-by-special-way">C# - Add watermark to the photo by special way</a>.  My special thanks to  <strong>Alex Maslakov</strong> and <strong>adrift</strong>.</p>
  
  <p>I implemented that solution with some modifications, i want to put watermark in center of the image.  I modified the solution provided by <strong>adrift</strong> as follows </p>
  
  <pre><code>   private void button1_Click(object sender, EventArgs e)
      {
          using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"))
          using (Image watermarkImage = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\watermark.png"))
          using (Graphics imageGraphics = Graphics.FromImage(image))
          using (Brush watermarkBrush = new TextureBrush(watermarkImage))
          {
              int x = (image.Width - watermarkImage.Width)/2;
              int y = (image.Height - watermarkImage.Height)/2;
              imageGraphics.FillRectangle(watermarkBrush, new Rectangle(new Point(x, y), watermarkImage.Size));
              image.Save(@"C:\Users\Public\Pictures\Sample Pictures\Desert_watermark.jpg");
          }
  
      }
  </code></pre>
  
  <p>but watermark is not properly placed in the center of image (see below image).</p>
  
  <p><img src="https://i.stack.imgur.com/QiHjV.jpg" alt="enter image description here"></p>
  
  <p>please correct me...</p>
  
  <p>thanks</p>