im trying to read an image(*.bmp) from file and then color the black pixels
in it to the color i want using argb. Below is the code of what im trying to
do but this gives me an error "setPixel is not supported for images with
indexed pixel format"
Please tell me what im doing wrong.
Dim c1 As Color = Color.Black
Dim c2 As Color = Color.FromArgb(CInt(colour))
Dim bm AsNew Bitmap(img)
Dim eX AsInteger
Dim eY AsInteger
Dim r AsInteger
Dim g AsInteger
Dim b AsInteger
r = c2.R
g = c2.G
b = c2.B
For eX = 0 To bm.Width - 1
For eY = 0 To bm.Height - 1
If bm.GetPixel(eX, eY).ToArgb = c1.ToArgb() Then
bm.SetPixel(eX, eY, Color.FromArgb(r, g, b))
EndIf
Next eY
Next eX
PeBox2.Image = bm
PeBox2.Location = New System.Drawing.Point(x, y)
PeBox2.Size = New System.Drawing.Size(width, height)
PeBox2.BorderStyle = BorderStyle.FixedSingle
PeBox2.Name = "PeBox2"
PeBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchIma ge
PeBox2.TabStop = False
Me.Controls.Add(PeBox2)