Resizing an image with alpha channel
- by Hafthor
I am writing some code to generate images - essentially I have a source image that is large and includes transparent regions.
I use GDI+ to open that image and add additional objects.
What I want to do next is to save this new image much smaller, so I used the Bitmap constructor that takes a source Image object and a height and width, then saved that.
I was expecting the alpha channel to be smoothed like the color channels, but this did not happen -- it did result in a couple of semitransparent pixels, but overall it is very blocky. What gives?
Using img As New Bitmap("source100x100.png")
''// Drawing stuff
Using simg As New Bitmap(img, 20, 20)
simg.Save("target20x20.png")
End Using
End Using
Edit: I think what I want is SuperSampling, like what Paint.NET does when set to "Best Quality"