M
Martin
I'm using the code show below (in VB.Net 2003) to create an image. I
want to save this image to a .PNG file such that when I subsequently
display it as part of a web page, the background of the image will be
transparent.
This test/learning code simply draws a diagonal green line across a
square box. When I display the resulting file on a web page, I want
only the line itself to be visible but what is happening is that the
entire "box" is shown (in a light grey color) with the line drawn
across it.
Any suggestions as to how I can do this?
Thanks.
-----------------------------------------------------------
Dim myPen As Pen = New Pen(Color.Green, 9))
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Color.Plum)
g.DrawLine(myPen, 0, 0, 100, 100)
bmp.MakeTransparent(Color.Plum)
bmp.Save("TestFile.png", System.Drawing.Imaging.ImageFormat.Png)
want to save this image to a .PNG file such that when I subsequently
display it as part of a web page, the background of the image will be
transparent.
This test/learning code simply draws a diagonal green line across a
square box. When I display the resulting file on a web page, I want
only the line itself to be visible but what is happening is that the
entire "box" is shown (in a light grey color) with the line drawn
across it.
Any suggestions as to how I can do this?
Thanks.
-----------------------------------------------------------
Dim myPen As Pen = New Pen(Color.Green, 9))
Dim bmp As Bitmap = New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Color.Plum)
g.DrawLine(myPen, 0, 0, 100, 100)
bmp.MakeTransparent(Color.Plum)
bmp.Save("TestFile.png", System.Drawing.Imaging.ImageFormat.Png)