title: What's the best way to "square" an image in .NET?
body: <p>I need generate <a href="https://stackoverflow.com/questions/27921/what-is-the-best-way-to-create-a-thumbnail-using-aspnet">thumbnails</a> for a bunch of jpegs (200,000+) but I want to make sure all of my thumbs have a equal height and width. However, I don't want to change the proportions of the image so I need to add empty space to the shorter dimension to "square it up".  The empty space's background color is variable.  </p>
  
  <p>Here's the code snippet I'm using to generate the thumbs. What's the best way to do the squaring?</p>
  
  <pre><code>     Dim imgDest As System.Drawing.Bitmap = New Bitmap(ScaleWidth, ScaleHeight)
       imgDest.SetResolution(TARGET_RESOLUTION, TARGET_RESOLUTION)  
       Dim grDest As Graphics = Graphics.FromImage(imgDest)
  
       grDest.DrawImage(SourceImage, 0, 0, imgDest.Width, imgDest.Height)
  </code></pre>