无聊, 就写了这个程序。
Imports System.Drawing Module Module1 Const Src = "hello.bmp", Bg = "xing.bmp", Des = "love.bmp" Dim SrcImg As Bitmap = Bitmap.FromFile(Src), BgImg As Bitmap = Bitmap.FromFile(Bg), DesImg As New Bitmap(SrcImg.Width, SrcImg.Height) Sub Main() For y = 0 To SrcImg.Height - 1 For x = 0 To SrcImg.Width - 1 Dim c = SrcImg.GetPixel(x, y) Dim d = BgImg.GetPixel(x, y) If c = Color.FromArgb(255, 0, 0, 0) Then If d <> Color.FromArgb(255, 255, 255, 255) Then DesImg.SetPixel(x, y, Color.DarkRed) Else DesImg.SetPixel(x, y, Color.DarkCyan) End If Else DesImg.SetPixel(x, y, Color.White) End If 'Debug.Print(c.ToString) Next Next Dim g = Graphics.FromImage(DesImg) g.DrawString("by Wandai twd2.me", New Font("微软雅黑", 8), Brushes.Brown, 25, 0) g.DrawString("!", New Font("微软雅黑", 8), Brushes.Brown, 40, 149) DesImg.Save(Des) Console.WriteLine("done.") Console.ReadKey() End Sub End Module
这里是输出的图片:
不解释。
不错!
好!