Resizing an image with alpha channel

Posted by Hafthor on Stack Overflow See other posts from Stack Overflow or by Hafthor
Published on 2009-03-10T18:07:11Z Indexed on 2010/05/08 10:48 UTC
Read the original article Hit count: 204

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"

© Stack Overflow or respective owner

Related posts about .NET

Related posts about gdi+