Sei sulla pagina 1di 1

//Creating Dynamic Watermark on image System.Drawing.Image objImage = System.Drawing.Image.FromFile(Server.MapPath("ootyflower.jpg"));//From File int height = objImage.

Height;//Actual image width int width = objImage.Width;//Actual image height System.Drawing.Bitmap bitmapimage = new System.Drawing.Bitmap(objImage, width, height);// create bitmap with same size of Actual image System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmapimage); //Creates a System.Drawing.Color structure from the four ARGB component //(alpha, red, green, and blue) values. Although this method allows a 32-bit value // to be passed for each component, the value of each component is limited to 8 bits. //create Brush SolidBrush brush = new SolidBrush(Color.FromArgb(113, 255, 255, 255)); //Adding watermark text on image g.DrawString("Raju.M C# Programmer Kerala,India.Dynamic WaterMark sample", new Font("Arial", 18, System.Drawing.FontStyle.Bold), brush, 0, 100); //save image with Watermark image/picture //bitmapimage.Save("watermark-image.jpg"); //if u want to save image Response.ContentType = "image/jpeg"; bitmapimage.Save(Response.OutputStream, ImageFormat.Jpeg);

Potrebbero piacerti anche