|
-
Mar 26th, 2008, 12:51 PM
#1
Thread Starter
Fanatic Member
SetPixel is not supported for images with indexed pixel formats.
Hello: I receive this error when trying to SET the color of a pixel. My images that I'm loading must be in black and white and therefore, I save them as bmp type. I'm looping through my pixels and if i find ones that are black, I determine if they are edge points. If yes, I want to change their pixel color to Red:
For X = 1 To myBmp.Width - 1 'Gets the width, in pixels, of this Image.
i = 0
For Y = 1 To myBmp.Height - 1 'Gets the height, in pixels, of this Image.
Select Case myBmp.GetPixel(X, Y).R 'Gets the color of the pixel
Case 255 'if white, don't do anything.
Case Else
'GET OUTTER EDGE POINTS
'LOOK NORTH
' If (X <> 0 And Y <> 0) Then
If myBmp.GetPixel(X, Y + 1).R = 255 Then
IsOutterPerimeter = True
End If
'LOOK SOUTH
If myBmp.GetPixel(X, Y - 1).R = 255 Then
IsOutterPerimeter = True
End If
'LOOK EAST
If myBmp.GetPixel(X - 1, Y).R = 255 Then
IsOutterPerimeter = True
End If
'LOOK WEST
If myBmp.GetPixel(X + 1, Y).R = 255 Then
IsOutterPerimeter = True
End If
' End If
If IsOutterPerimeter = True Then
'THIS IS THE LINE IT BOMBS ON myBmp.SetPixel(X, Y, System.Drawing.Color.Red)
End if
Has anyone else experienced this?
Any ideas would be appreciated.
Thanks,
Proctor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|