Convert Picture into Grayscale.
Convert Picture into Grayscale.
Rate Convert Picture into Grayscale.
(1(1 Vote))
'behind the button.
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
Convert Picture into Grayscale. Comments
No comments yet — be the first to post one!
Post a Comment