title: How can I crop an image to a circle?
body: <p>I'm trying to crop an image to a circle, where the area outside of the circle is white.</p>
  
  <p>The new image dimensions would be the same as the original, just effectively rounding the image.</p>
  
  <p>I'm familiar with how to crop an image using GDI+ to draw a rectangle/square by taking the existing image and copying it into a new one but i can't see how to fill the outside of an arc/circle with white.</p>
  
  <p>Is this possible?</p>
  
  <p>update - i want to do it server side because different browsers/platforms render css radius differently, or not at all</p>
  
  <p>my work so far is:</p>
  
  <pre><code>public static Image CropCircle2(Image imgSource)
      {
          Image imgTarget = new Bitmap(imgSource.Width, imgSource.Height);
          Graphics g = Graphics.FromImage(imgTarget);
          var path = new System.Drawing.Drawing2D.GraphicsPath();
          path.AddEllipse(0, 0, imgTarget.Width, imgTarget.Height);
          g.SetClip(path);
          g.DrawImage(imgSource, 0, 0);
  
          return imgTarget;
      }
  </code></pre>