用C#实现。图片本身的属性不变,比如本来透明的转换后还透明等等。
谢谢

解决方案 »

  1.   

    Dim bmpCurrentImage As Bitmap       '将当前显示的图片定义为位图格式
            Dim intXCount As Integer            '为图片扫描定义水平循环变量
            Dim intYCount As Integer            '为图片扫描定义水平循环变量
            Dim intImageWidth As Integer        '当前图片宽度
            Dim intImageHeight As Integer       '当前图片高度
            Dim clrPixelColor As Color          '图片上某一点的象素颜色
            Dim intPixelColorR As Integer       '该点像素颜色的R分量
            Dim intPixelColorG As Integer       '该点像素颜色的G分量
            Dim intPixelColorB As Integer       '该点像素颜色的B分量
            Dim clrChangePixelColor As Color    '图片上某一点反白后的象素颜色
            Try
                If M_BlnIsClickReload = False Then                Dim frmWait As New Form
                    frmWait = CreateForm()
                    bmpCurrentImage = CType(pboPicture.Image, Bitmap)
                    intImageWidth = bmpCurrentImage.Width
                    intImageHeight = bmpCurrentImage.Height     '获取当前图片的高度和宽度
                    '对全图进行颜色反白
                    For intYCount = 0 To intImageHeight - 1
                        For intXCount = 0 To intImageWidth - 1
                            clrPixelColor = bmpCurrentImage.GetPixel(intXCount, intYCount)      '获取每一个象素点
                            intPixelColorR = clrPixelColor.R()
                            intPixelColorG = clrPixelColor.G()
                            intPixelColorB = clrPixelColor.B()      '获取每一个象素点R、G、B的值
                            '对图片中每一个像素点都进行反白处理
                            clrChangePixelColor = clrChangePixelColor.FromArgb(255 - intPixelColorR, _
                                                            255 - intPixelColorG, 255 - intPixelColorB)
                            '按反白后的颜色值重新绘制每一个像素点
                            bmpCurrentImage.SetPixel(intXCount, intYCount, clrChangePixelColor)
                        Next intXCount
                    Next intYCount
                    frmWait.Close()
                    pboPicture.Image = CType(bmpCurrentImage, Image)      '显示反白后的图片
                    M_ImgDrawMark = pboPicture.Image
                End If
      

  2.   

    我记得 饱和度-》0 或者(r+g+b)/3 作为象素身度
      

  3.   

    在Codeproject中有一个示例应用程序。你可以找一下。GDI+方面的。叫iplab的一个库。可以参考一下。