Dynamically Add Watermark On Image ASP.NET C#
How to create watermark on image. you can simply create watermarks text on image
//used namespaces
//using System.IO;
//using System.Drawing.Drawing2D;
//using System.Drawing;
//using System.Drawing.Imaging;
///Locate Image from Image folder.
System.Drawing.Image objImage = System.Drawing.Image.FromFile(Server.MapPath("images/Copy.jpg"));
//Taken Actual width anf height From Image
int height = objImage.Height;//height
int width = objImage.Width;//Width
//Create a Bitmap Image
System.Drawing.Bitmap bitmapimage = new System.Drawing.Bitmap(objImage, width, height);// create bitmap with same size of Actual image
//Convert in to a Graphics object
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmapimage);
//Creating Brushe
System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(113, 255, 255, 255));
g.DrawString("Raju.M C# Programmer Kerala,India.Dynamic WaterMark sample", new Font("Arial", 18, System.Drawing.FontStyle.Bold), brush, 0, 100);
Response.ContentType = "image/jpeg";//setting ContentType
bitmapimage.Save(Response.OutputStream, ImageFormat.Jpeg);//save image with dynamic watermark
Download Source
5 comments:
It is really good. Thanks for this
it is good.
but my requrement is save this water marked image to databas.
iam using sqlserver please send me code.
dynamic watermarking working fine.
but my requriment is save this water mark image into sqlserver database.
please send me code.
@vikranthreddy Save bitmap binary data in your database
Hello Mr Raju.
Thanks for nice post.
i want to make this kind of watermark.
http://www.istockphoto.com/stock-photo-17413971-dutch-cow.php?st=77e21c7
Is it possible ? Yes then how ?
Post a Comment