"resize image and add watermark c#" Code Answer's
You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "resize image and add watermark c#" answered properly. Developers are finding an appropriate answer about resize image and add watermark c# related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like resize image and add watermark c#. Enter your desired code related query in the search bar and get every piece of information about C# code related question on resize image and add watermark c#.
resize image and add watermark c#
void waterMarkOnBottomRight(Image img, Image watermarkImage, string saveFileName)
{
double imageHeightBrand = Convert.ToDouble(watermarkImage.Height);
double imageWidthBrand = Convert.ToDouble(watermarkImage.Width);
double ratioBrand = imageWidthBrand / imageHeightBrand;
double imageHeightBild = Convert.ToDouble(img.Height); //height of the image to watermark
double imageWidthBild = Convert.ToDouble(img.Width);
var imageWidthTmpBranding = imageWidthBild * 0.2; //the watermark width, but only 20% size of the image to watermark
var imageHeightTmpBranding = imageWidthTmpBranding / ratioBrand; //height of watermark, preserve aspect ratio
int imageWidthBranding = Convert.ToInt32(imageWidthTmpBranding); //convert in into int32 (see method below)
int imageHeightBranding = Convert.ToInt32(imageHeightTmpBranding);
int watermarkX = (int)(imageWidthBild - imageWidthBranding); // Bottom Right
int watermarkY = (int)(imageHeightBild - imageHeightBranding);
using (Graphics g = Graphics.FromImage(img))
g.DrawImage(watermarkImage,
new Rectangle(watermarkX, watermarkY, imageWidthBranding, imageHeightBranding),
new Rectangle(0, 0, (int)imageWidthBrand, (int)imageHeightBrand),
GraphicsUnit.Pixel);
img.Save(saveFileName);
}
Source: stackoverflow.com
All those coders who are working on the C# based application and are stuck on resize image and add watermark c# can get a collection of related answers to their query. Programmers need to enter their query on resize image and add watermark c# related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about resize image and add watermark c# for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of resize image and add watermark c# while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "resize image and add watermark c#". Visit this developer's friendly online web community, CodeProZone, and get your queries like resize image and add watermark c# resolved professionally and stay updated to the latest C# updates.