-
Transparent BMP's
Is it possible to change the alpha colour on a transparent BMP, in VB .NET?
The reason is, when I load a transparent image, and store it in an image list with transparency, and then save that image from there, it gives it a black background… which is not what I want.
-
i have the feeling BMP format doesnt support transparency...i think u are talking about WMF or PNG or GIF right?
-
Scan the image for transparent pixels, and convert them to a colour.
Code:
Dim x As Integer, y As Integer
For x = 0 To Img.Width - 1
For y = 0 To Img.Height - 1
If Img.GetPixel(x, y).ToArgb = 0 Then Img.SetPixel(x, y, Color.FromArgb(0, 0, 255, 0))
Next
Next
-
If you load a BMP into a picture box, or image list, etc, it does support transparency. However, when you save it to disk, the transparent layer is issued a colour – I don’t know how and why it works like this… it just does. My solution is above.
-
Quote:
Originally posted by guiledotNET
Scan the image for transparent pixels, and convert them to a colour.
Code:
Dim x As Integer, y As Integer
For x = 0 To Img.Width - 1
For y = 0 To Img.Height - 1
If Img.GetPixel(x, y).ToArgb = 0 Then Img.SetPixel(x, y, Color.FromArgb(0, 0, 255, 0))
Next
Next
that would be quite inefficient :) dont have my book with me now, otherwise I would post something better ...
-
If you are able to, later, I would appreciate it.