Hi, I'm trying to write a function that takes an image and a given value and then changes the opacity of the image. Though, when I try to run the code nothing happens. Can someone look at the code and tell me what I did wrong?
Public Function SetOpacity(ByVal Image As Bitmap, ByVal Opacity As Integer, ByVal G As Graphics) As Image
Dim NewImage As New Bitmap(Image.Width, Image.Height, G)
G = Graphics.FromImage(NewImage)
G.Clear(Color.Transparent)
For X As Integer = 1 To Image.Width
For Y As Integer = 1 To Image.Height
Dim BasicColor As Color = Image.GetPixel(X, Y)
NewImage.SetPixel(X, Y, Color.FromArgb(Opacity, _
BasicColor.R, BasicColor.G, BasicColor.B))
Next
Next
Return NewImage
End Function
Thanks,
J-P