ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Add Watermark Text to TIFF Image using C# and VB.Net<p>Hi&nbsp;Vinoth548,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Namespaces</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Drawing; using System.IO;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Drawing Imports System.IO</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Upload(object sender, EventArgs e) { string fileName = @&#34;C:\Users\dharmendra\Desktop\Jellyfish.tiff&#34;; string watermarkText = &#34;copy rights&#34;; Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); System.Drawing.Image image = System.Drawing.Image.FromStream(stream); using (Graphics grp = Graphics.FromImage(image)) { Brush brush = new SolidBrush(Color.Red); Font font = new Font(&#34;Arial&#34;, 30.0f, FontStyle.Bold, GraphicsUnit.Pixel); SizeF textSize = grp.MeasureString(watermarkText, font); Point position = new Point((image.Width - ((int)textSize.Width + 10)), (image.Height - ((int)textSize.Height + 10))); grp.DrawString(watermarkText, font, brush, position); stream.Dispose(); File.Delete(fileName); image.Save(fileName); } }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Upload(ByVal sender As Object, ByVal e As EventArgs) Dim fileName As String = &#34;C:\Users\dharmendra\Desktop\tiff\Jellyfish.tiff&#34; Dim watermarkText As String = &#34;copy rights&#34; Dim stream As Stream = New FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read) Dim image As System.Drawing.Image = System.Drawing.Image.FromStream(stream) Using grp As Graphics = Graphics.FromImage(image) Dim brush As Brush = New SolidBrush(Color.Red) Dim font As Font = New Font(&#34;Arial&#34;, 30.0F, FontStyle.Bold, GraphicsUnit.Pixel) Dim textSize As SizeF = grp.MeasureString(watermarkText, font) Dim position As Point = New Point((image.Width - (CInt(textSize.Width) + 10)), (image.Height - (CInt(textSize.Height) + 10))) grp.DrawString(watermarkText, font, brush, position) stream.Dispose() File.Delete(fileName) image.Save(fileName) End Using End Sub</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong>Before Adding Watermark</strong></p> <p><strong><img src="https://i.imgur.com/D6sT90S.jpg" alt="" width="347" height="262" /></strong></p> <p><strong>After Adding Watermark</strong></p> <p><strong><img src="https://i.imgur.com/B3Kznnb.jpg" alt="" width="347" height="259" /></strong></p>https://www.aspforums.net:443/Threads/160005/Add-Watermark-Text-to-TIFF-Image-using-C-and-VBNet/https://www.aspforums.net:443/Threads/160005/Add-Watermark-Text-to-TIFF-Image-using-C-and-VBNet/Tue, 18 Dec 2018 04:08:59 GMT