wiki.php 用Markdown写wiki是一种什么样的体验?

图像灰阶、灰度.md

最后更新于 2019-10-06 15:00:29

http://rhroan.pixnet.net/blog/post/42771388

Shared Function Grayscale(ByVal img As Bitmap) As Bitmap
    Static cm As New Imaging.ColorMatrix(New Single()() {New Single() {0.3, 0.3, 0.3, 0, 0}, New Single() {0.59, 0.59, 0.59, 0, 0}, New Single() {0.11, 0.11, 0.11, 0, 0}, New Single() {0, 0, 0, 1, 0}, New Single() {0, 0, 0, 0, 1}})

    Dim ia As New Imaging.ImageAttributes()
    ia.SetColorMatrix(cm)

    Dim newimg As New Bitmap(img.Width, img.Height, img.PixelFormat)
    Using g As Graphics = Graphics.FromImage(newimg)
        Dim rect As New Rectangle(0, 0, img.Width, img.Height)
        g.DrawImage(img, rect, 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, ia)
    End Using

    Return newimg
End Function