5
Февраль
2009
Как конвертировать цветную картинку в черно-белую?
Как конвертировать цветную картинку в черно-белую?
Option Explicit Dim b1 As Byte, b2 As Byte, b3 As Byte Dim lColor&, x&, y&, Gray! Private Sub Command1_Click() Picture2.Cls For x = 0 To Picture1.ScaleWidth For y = 0 To Picture1.ScaleHeight lColor = Picture1.Point(x, y) b1 = lColor And &HFF b2 = (lColor \ 256) And &HFF b3 = (lColor \ 65536) And &HFF Gray = b1 * 0.3 + b2 * 0.59 + b3 * 0.11 lColor = RGB(Gray, Gray, Gray) Picture2.PSet (x, y), lColor Next y DoEvents Next x End Sub