I’m trying to create an image with a transparent background to display on a web page.
I’ve tried several techniques but the background is always black.
How can I create a transparent image and then draw some lines on it ?
I’m trying to create an image with a transparent background to display on a
Share
Call
Graphics.Clear(Color.Transparent)to, well, clear the image. Don’t forget to create it with a pixel format that has an alpha channel, e.g.PixelFormat.Format32bppArgb. Like this:Assumes you’re
usingSystem.DrawingandSystem.Drawing.Imaging.Edit: Seems like you don’t actually need the
Clear(). Just creating the image with an alpha channel creates a blank (fully transparent) image.