Something like this:
VB Code:
Dim objImage As Bitmap
objImage = New Bitmap("C:\Temp\Test.jpg")
Dim i As Integer
Dim j As Integer
Dim objOutput As New Bitmap(objImage.Width, objImage.Height, Imaging.PixelFormat.Format24bppRgb)
For i = 0 To objImage.Width - 1
For j = 0 To objImage.Height - 1
'Since it is grayscale all 3 RGB values are the same, so we just check one
If objImage.GetPixel(i, j).R < 128 Then
objOutput.SetPixel(i, j, Color.Black)
Else
objOutput.SetPixel(i, j, Color.White)
End If
Next
Next
objOutput.Save("C:\Temp\Output.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
MsgBox("Done")