Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


convert image


convert image

Author
Message
jay12
jay12
Forum God
Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)

Group: Forum Members
Posts: 11, Visits: 10

I have a simple program to convert an image in a picture box into as grayscale image ,from what i have been told it is possible to then change that image in to a black and white image with certain levels of gray being converted to black and lower levels of gray being converted into white how would i do this
here is my code to change into gray scale
what would i need to add to this code



Private Sub cmdGray_Click()
Pic.ScaleMode = vbPixels
X = Pic.ScaleWidth
y = Pic.ScaleHeight
For i = 0 To y - 1
For j = 0 To X - 1
pixel = Pic.Point(j, i)
red = pixel Mod 256
green = ((pixel And &HFF00) / 256& Mod 256&
blue = (pixel And &HFF0000) / 65536

gs = ((red * 30) + (green * 59) + (blue * 11)) / 100
Pic.PSet (j, i), RGB(gs, gs, gs)

Next
Next
Pic.ScaleMode = vbTwips
End Sub

 

thanks


RoofRabbit
RoofRabbit
Forum God
Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)Forum God (5.2K reputation)

Group: Forum Members
Posts: 38, Visits: 23
I'd just take the value in "pixel" and compare it to 1/2 it's maximum value. If less, set pixel = 0, else set to max value (depending color display mode used).




Website: http://roofrabbit.com
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search