vb.net图像处理

包裹

在创建一个添加水印的程序以及创建一个删除该水印的程序之后,我今天的任务是要执行任务。

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

这是准确的还是实际上是一种方法?(不需要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
RQDQ

您是正确的-添加水印比删除水印要容易得多。标准方法是将原始副本保留在某个位置,并使用该副本,而不是事后尝试处理该图像。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章