0

I found this discussion about images: Adding an invisible image watermark in C#?

And I've found some good open source libraries for watermarking raster images. One example: https://www.nuget.org/packages/Grizlah.Steganography.F5.StegSharp.Infrastructure

My interest is in watermarking SVG images. I know that different algorithms would be involved with vector.

1 Answer 1

0

If you have a library to manipulate svg, just add a similar group like that into the svg. Your could calculate the repition of the use elements by the width and height of the svg.

you can use svg dotnet nuget to do this.

 var sampleDoc = SvgDocument.Open<SvgDocument>("filePath")
 var waterMarkDoc = SvgDocument.FromSvg<SvgDocument>("<svg xmlns='http://www.w3.org/2000/svg' height='500px' width='500px' >
      <g>
        <text id="mark" transform="rotate(-45)" fill='rgba(45,45,45,0.3)' font-size='18'>
        watermark
        </text>
        <use href="#mark" x="100" y = "100"/>
        <use href="#mark" x="200" y = "100"/>
        <use href="#mark" x="300" y = "100"/>
        <use href="#mark" x="100" y = "200"/>
        <use href="#mark" x="200" y = "200"/>
        <use href="#mark" x="300" y = "200"/>
      </g>
 </svg>")
  foreach(var element in watermark.Children){
     sampleDoc.Children.Add(element);
  }


 sampleDoc.Draw().Save("filename.png"));

output

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.