Re: Working with pictures
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")
Re: Working with pictures
That's what I thought at first, but that way surely would take many time for each image(well..actually the pictures are just 20x20) but they are A LOT and I'll have to be continuosly doing the process. I thought maybe there would be something along the matrixcolor classes or something that would be faster.
But if there's not, then thanks by the code
Re: Working with pictures
Have you seen this link:
http://www.bobpowell.net/onebit.htm
Looks like his way is very similar to mine.
Re: Working with pictures
I'm actually having problems puting the code to work as it seems I can't do SetPixel with the format of the picture I'm using.
Additional information: SetPixel is not supported for images with indexed pixel formats.How can I convert the pixel format to an affordable one?