1

我今天的任务是创建一个添加水印的程序以创建一个删除相同水印的程序。

我的想法是它现在是图像的一部分,不能轻易删除。

这是准确的还是实际上是一种方法?(这不需要10年)

感谢您的任何提示

这是我添加水印的代码:

    Dim watermark_bm As Bitmap = Global.AnchorAuditor.My.Resources.Logo_White
    Dim watermark_bm2 As Bitmap = Global.AnchorAuditor.My.Resources.CLS_Logo_White_Engineering

    'watermark_bm2.MakeTransparent()

    ' WATERMARK IMAGE 1 - AA
    Using str As Stream = File.OpenRead(s)

        Dim or_bm As Bitmap = Image.FromStream(str)

        '''''''''''''''''''''''''START IMAGE 1''''''''''''''''''''''''''

        or_bm.SetResolution(20, 20)

        Dim x1 As Integer = or_bm.Width - 300
        Dim Y As Integer = or_bm.Height - 300

        Const ALPHA As Byte = 128
        ' Set the watermark's pixels' Alpha components.
        Dim clr As Color
        For py As Integer = 0 To watermark_bm.Height - 1
            For px As Integer = 0 To watermark_bm.Width - 1
                clr = watermark_bm.GetPixel(px, py)
                watermark_bm.SetPixel(px, py, _
                    Color.FromArgb(ALPHA, clr.R, clr.G, clr.B))
            Next px
        Next py

        ' Set the watermark's transparent color.
        watermark_bm.MakeTransparent(watermark_bm.GetPixel(0, _
            0))

        ' Copy onto the result image.
        Dim gr As Graphics = Graphics.FromImage(or_bm)
        gr.DrawImage(watermark_bm, x1, Y)

        '''''''''''''''''''''''''END IMAGE 1 START IMAGE 2''''''''''''''''''''''''''

        or_bm.SetResolution(60, 60)

        Dim x2 As Integer = 75
        Dim Y1 As Integer = 75

        Const ALPHA1 As Byte = 128
        ' Set the watermark's pixels' Alpha components.
        Dim clr1 As Color
        For py As Integer = 0 To watermark_bm2.Height - 1
            For px As Integer = 0 To watermark_bm2.Width - 1
                clr1 = watermark_bm2.GetPixel(px, py)
                watermark_bm2.SetPixel(px, py, _
                    Color.FromArgb(ALPHA1, clr1.R, clr1.G, clr1.B))
            Next px
        Next py

        ' Set the watermark's transparent color.
        watermark_bm2.MakeTransparent(watermark_bm2.GetPixel(0, _
            0))

        ' Copy onto the result image.
        Dim gr1 As Graphics = Graphics.FromImage(or_bm)
        gr1.DrawImage(watermark_bm2, x2, Y1)


        ''''''''''''''''''''''''END IMAGE 2'''''''''''''''''''''''''''
        or_bm.Save(s & "deleteme.jpg", _
        System.Drawing.Imaging.ImageFormat.Jpeg)

    End Using
4

1 回答 1

3

你是对的 - 添加水印比删除它容易得多。标准方法是在某处保留原始副本并使用它,而不是在之后尝试操纵图像。

于 2013-07-09T15:55:47.447 回答