VB .net 影像RESIZE函式
Public Function ResizeBitmap(ByRef b As Bitmap, ByRef dstWidth As Integer, ByRef dstHeight As Integer) As Bitmap
Dim dstImage As Bitmap = New Bitmap(dstWidth, dstHeight)
Dim gx As System.Drawing.Graphics = Graphics.FromImage(dstImage)
' SET插值模式
gx.InterpolationMode = Drawing2D.InterpolationMode.Bilinear
' SET平滑模式
gx.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
gx.DrawImage(b, New Rectangle(0, 0, dstImage.Width, dstImage.Height), New Rectangle(0, 0, b.Width, b.Height), GraphicsUnit.Pixel)
gx.Save()
gx.Dispose()
Return dstImage
End Function ' end of Resize
留言