I am using this code to re-size small images into a bigger size.
the Issue that I am having is that it stretches the images and I would like to re-size but keep the aspect ratio so that it doesn't stretch out.. how can I do this?
Public Sub ResizeImage(ByVal fileName As String, ByVal width As Integer, height As Integer)
Dim bm As New Bitmap(fileName)
Dim thumb As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(thumb)
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(bm, New Rectangle(0, 0, width, height), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
thumb.Save(fileName & "new.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)