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














留言

這個網誌中的熱門文章

Office 2021 離線安裝封裝與KMS啟動步驟

Ollama使用心得與模型導入教學

ARC下NSMutableDictionary 無法使用retainCount