Print Page | Close Window

Watermark an Image

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=16957
Printed Date: 29 March 2026 at 12:03pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Watermark an Image
Posted By: seanlail
Subject: Watermark an Image
Date Posted: 19 October 2005 at 4:43pm

I've seen that with Lunix and php you can add a watermarked to an image based on a gif you have.

I dont understand it completely, so if my terminology is wrong, "oops".

My question is... is there a way to do this with ASP or ASP.Net???

Embarrassed



Replies:
Posted By: michael
Date Posted: 19 October 2005 at 4:56pm
In asp.net it is very simple to do. Not so sure about asp. This is how I am using it on my gallery
 

Public Sub AddWatermark(filename As String, watermarkText As String, outputStream As Stream)


   Dim bitmap As Bitmap = Bitmap.FromFile(filename)
   Dim font As New Font("Arial", 20, FontStyle.Bold, GraphicsUnit.Pixel)
   Dim color As Color = Color.FromArgb(10, 0, 0, 0) 'Adds a black watermark with a low alpha value (almost transparent).
   Dim atPoint As New Point(100, 100) 'The pixel point to draw the watermark at (this example puts it at 100, 100 (x, y)).
   Dim brush As New SolidBrush(color)
  
   Dim graphics As Graphics = Nothing
      graphics = Graphics.FromImage(bitmap)
 
   
   graphics.DrawString([text], font, brush, atPoint)
   graphics.Dispose()
   
   bitmap.Save(outputStream)
End Sub

 
To call it, just add something like this to your aspx file (assume the class is called MyImage):
 

Dim filename As String = "../images/someimage.jpg"

Dim image As New MyImage()
image.AddWatermark(filename, "Watermark Test", HttpResponse.OutputStream)


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: dpyers
Date Posted: 20 October 2005 at 8:21pm
I think you can merge two images with aspjpeg.

-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net