add watermark to image diagonally using jquery or javascript
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Muralishankar SundaramPosted Jun 9, 2015, 1:40 PM
Nilesh JadavPosted Jun 6, 2015, 12:51 AM
Try this links : http://www.aspsnippets.com/Articles/Create-Add-Watermark-Text-to-Images-Photo-in-ASPNet-using-C-and-VBNet.aspx
or might be this works :
protectedvoidUpload(objectsender, EventArgs e){stringwatermarkText ="© ASPSnippets.com";//Get the file name.stringfileName = Path.GetFileNameWithoutExtension(FileUpload1.PostedFile.FileName) +".png";//Read the File into a Bitmap.using(Bitmap bmp =newBitmap(FileUpload1.PostedFile.InputStream,false)){using(Graphics grp = Graphics.FromImage(bmp)){//Set the Color of the Watermark text.Brush brush =newSolidBrush(Color.FromArgb(99, Color.Black));//Set the Font and its size.Font font =newSystem.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);//Determine the size of the Watermark text.SizeF textSize =newSizeF();textSize = grp.MeasureString(watermarkText, font);//Position the text and draw it on the image.Point position =newPoint((bmp.Width / 2), (bmp.Height / 2));//Rotate and Drawgrp.TranslateTransform(position.X / 2, position.Y / 2);grp.RotateTransform(-45);grp.DrawString(watermarkText, font, brush, position.X - ((int)textSize.Width + 10), position.Y - ((int)textSize.Height + 10));grp.ResetTransform();using(MemoryStream memoryStream =newMemoryStream()){//Save the Watermarked image to the MemoryStream.bmp.Save(memoryStream, ImageFormat.Png);memoryStream.Position = 0;//Start file download.Response.Clear();Response.ContentType ="image/jpg";Response.AddHeader("Content-Disposition","attachment; filename="+ fileName);//Write the MemoryStream to the Response.memoryStream.WriteTo(Response.OutputStream);Response.Flush();Response.Close();Response.End();}}}}