You are here: HomeForums » .NET » Visual Basic .NET » Simple function that resizes an image

Simple function that resizes an image (1 post)

in Forums » .NET » Visual Basic .NET
  • Started 1 month ago by thdadmin

thdadmin (administrator)

Very simple and practical function to resize an image. If you have something that can crop and image I would appreciate it :)

Public Function ResizeImage(ByVal iImage As Bitmap, ByVal ScaleX As Single, ByVal ScaleY As Single, ByVal iMode As InterpolationMode) As Bitmap
        'Receives an image as input and scales it up or down
        Dim g As Graphics
        Dim sImage As Bitmap = New Bitmap(CInt(iImage.Width * ScaleX), CInt(iImage.Height * ScaleY))
        g = Graphics.FromImage(sImage)
        g.InterpolationMode = iMode
        g.DrawImage(iImage, 0, 0, sImage.Width, sImage.Height)
        ResizeImage = sImage
End Function
Posted 1 month ago #

Reply

You must log in to post.