在VB中显示灰度图怎样实现,
使用 BITMAPINFO 结构时,写不了调色板,
郁闷啊,请大家帮忙看看,路过的请顶一下啊。

解决方案 »

  1.   

    现成的 VB 代码:http://www.vbprobe.com/source/showdoc.asp?detail_id=2849
      

  2.   

    简单的理解看这个:http://vbboshi.myrice.com/vbtech/image/page_2/file58.htm
      

  3.   

    Public Function ConvertToGrayscale(ByVal source As Bitmap) as Bitmap    Dim bm as new Bitmap(source.Width,source.Height)    Dim x    Dim y    For y=0 To bm.Height        For x=0 To bm.Width            Dim c as Color = source.GetPixel(x,y)            Dim luma as Integer = CInt(c.R*0.3 + c.G*0.59 + c.B*0.11)            bm.SetPixel(x,y,Color.FromArgb(luma,luma,luma)        Next    Next    Return bmEnd Function