Hi,
I'm loading an image into a memorystream from my server.
Dim MS As New MemoryStream(wc.DownloadData(result)) ' wc = webclient
Dim myimage = Image.FromStream(MS)
mytab.image = myimage
This works, but I want to scale the image to 16px*16px. How do I do that?
I tried the following, but the images isn't smaller:
vb.net Code:
Dim bm As New Bitmap(myimage)
Dim w As Integer = 16 'image width.
Dim h As Integer = 16 'image height
Dim thumb As New Bitmap(w, h)
Dim g As Graphics = Graphics.FromImage(thumb)
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(bm, New Rectangle(0, 0, w, h), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
g.Dispose()
mytab.image = bm
EDIT: The image can be .png (transparent), bmp, jp(e)g, gif
Thanks in advance.