Question ScaleTransform blurring images

Vilavek

New member
Joined
Apr 9, 2009
Messages
2
Location
Las Vegas
Programming Experience
5-10
Using VB.NET in Visual Studio 2005, whenever I load a bitmap image and attempt to scale it using ScaleTransform, it blurs the image. Now I’m not talking about the normal blurring which occurs when you scale a smaller image beyond its native width/height. I'm talking Windows Picture Viewer style Gaussian blurring. I would prefer it if ScaleTransform wouldn't apply a blur filter when resizing images beyond their native resolution, but simply allowed pixelization to occur. Is this possible? Here is my simple code: :rolleyes:

VB.NET:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    Dim g As System.Drawing.Graphics

    g = e.Graphics()
    g.ScaleTransform(4, 4, MatrixOrder.Append)

    Dim bitmap As New Bitmap("E:\Pictures\baa2674c54df8c1c370dcb1053014642.jpg")

    g.DrawImage(bitmap, 0, 0)
End Sub
 
I’m sure I’m not the only one who hates it when you make a post begging for help and then you figure it out less than five minutes later. :rolleyes: Apparently there is an InterpolationMode option, as seen in the following code:

VB.NET:
g.InterpolationMode = InterpolationMode.NearestNeighbor

I apologize for the useless post, hopefully someone will make use of it lol. :D
 
Back
Top