Originally Posted by
Kerry Brown
What was the code you tried ??
and what was the actual error message. ?
I used this code right after the system.drawing.bitmap was created and just before I passed it to the picturebox:
(without this code the image shows with no errors)
Code:
Dim x As Integer
Dim y As Integer
For x = 0 To image.Width - 1 Step 1
For y = 0 To image.Height - 1 Step 1
Dim clr As Color = image.GetPixel(x, y)
Dim clr2 As Color
If InvertAlpha Then
clr2 = Color.FromArgb(255 - clr.A, 255 - clr.R, 255 - clr.G, 255 - clr.B)
Else
clr2 = Color.FromArgb(clr.A, 255 - clr.R, 255 - clr.G, 255 - clr.B)
End If
image.SetPixel(x, y, clr2)
Next
Next
and got the error "SetPixel is not supported for images with indexed pixel formats"
I did take out the "InvertAlpha" stuff. The way I read the web site I got this from seemed to indicate that this was an optional setting for whether or not you wanted to invert the image and since I always want to.. I took it out.