Step 1: Call the page where you code for image merging :
Step 2: Add the below code in code behind:-
using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; protected void Page_Load(object sender, EventArgs e) { string ThumbnailPath = Server.MapPath(@"images/testimage.jpg"); string watermark =Server.MapPath(@"images/watermark.png"); drawimagewm(ThumbnailPath, watermark, 50, 50); } public void drawimage(string imageurl, string watermark, int startx, int starty) { string ThumbnailPath = imageurl; string Thumb_WMPath = watermark; System.Drawing.Image image = System.Drawing.Image.FromFile(ThumbnailPath); System.Drawing.Image img_WM = System.Drawing.Image.FromFile(Thumb_WMPath); int width = image.Width; int height = image.Height; int width2 = img_WM.Width; int height2 = img_WM.Height; System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(image); graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.CompositingQuality = CompositingQuality.HighQuality; if (startx > (width - width2) || starty > (height - (height2))) { graphics.DrawImage(image2, new Point(startx, starty)); } // I use 50 for gapping between two watermark... for (int i = startx; i < (width - (width2)); i = i + width2 + 50) { for (int j = starty; j < (height - (height2)); j = j + height2 + 50) { graphics.DrawImage(img_WM, new Point(i, j)); } } ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders(); EncoderParameters encoderParameters; encoderParameters = new EncoderParameters(1); encoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L); string sExt = System.IO.Path.GetExtension(ThumbnailPath); Response.ContentType = "image/jpeg"; if (sExt.ToString() == ".jpg" || sExt.ToString() == ".jpeg") { image.Save(Response.OutputStream, info[1], encoderParameters); } else { image.Save(Response.OutputStream, image.RawFormat); } image.Dispose(); img_WM.Dispose(); }
51 thoughts on - Show image with watermark dynamic using code
https://buysildenshop.com/ – can i buy viagra without a prescription
Amoxicillin First Trimester Safe
http://buytadalafshop.com/ – Cialis
Kamagra En France En Ligne
Vigara From India
best place to buy generic cialis online
Viagra By Mail
viagra order
buy propecia 5mg usa
http://buypropeciaon.com/ – Propecia
where to buy stromectol without prescription
http://buystromectolon.com/ – buy ivermectin
https://buyplaquenilcv.com/ – Plaquenil
Zithromax Weekly
https://buylasixshop.com/ – lasix and potassium
Indian Pharmacy Online Mastercard
Cheap Genuine Kamagra
Annulation Avec Clomid
where to buy plaquenil
azithromycin tablets
Lasix
Priligy
https://buyzithromaxinf.com/ – zithromax half life
http://buypriligyhop.com/ – Priligy
http://buyneurontine.com/ – Neurontine
Buy Wellbutrin Xl Online Uk
buying cialis online safely
Vente Cialis Blog
Buy Kamagra Donne
Is Generic Cialis Safe
Cialis
cialis viagra levitra samples
dapoxetine priligy
Prednisone
Zithromax 250 Mg Tablets
Info On Cephalexin 250mg
20 Mg Lisinopril Sale No Perscription
Discount Fedex Shipping Acticin Medication No Rx
gabapentin use
Cialis Prix En Pharmacie Marseille
viagra de farmacia
Priligy Funziona 2012
cialis generic online
discount drug viagra xenical celebrex propecia
prix du viagra
dogAromy http://alevitrasp.com soyloart
Gpoeha where can i buy plaquenil in tucson az
처방전 필요없는 비아그라 구입 사이트 비아몰 정품시알리스 진품
I am very impressed with your writing baccaratcommunity I couldn’t think of this, but it’s amazing! I wrote several posts similar to this one, but please come and see!
Do you think my chances will be better with something more aggressive like injectables viagra vs cialis The box with just the guaifenesin was blue
Challenge accepted – dive into the world of gaming Lucky Cola