1. Herfried K. Wagner’s VB.Any
  2. .NET
  3. Frequently Asked Questions

Resizing an image with a certain interpolation mode

Resizing an image with a certain interpolation mode
<URL:https://dotnet.currifex.org/dotnet/faqs/interpolationmode/en/>
----------------------------------------------------------------------------

Resizing an image with a certain interpolation mode

\\\
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
.
.
.
Dim bmp1 As New Bitmap("C:\big.bmp")
Dim bmp2 As New Bitmap( _
    bmp1.Width * 0.1, _
    bmp1.Height * 0.1, _
    PixelFormat.Format24bppRgb _
)
Dim g As Graphics = Graphics.FromImage(bmp2)

' Select/change interpolation mode here.
g.InterpolationMode = InterpolationMode.HighQualityBicubic

' Draw image using specified interpolation mode.
g.DrawImage(bmp1, 0, 0, bmp2.Width, bmp2.Height)
g.Dispose()

bmp2.Save("C:\small.bmp")
bmp1.Dispose()
bmp2.Dispose()
///