I need generate thumbnails 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.
Here's the code snippet I'm using to generate the thumbs. What's the best way to do the squaring?
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)