meta info
- Title: LazZiya.ImageResize - Add Image Watermark
- Keywords: asp.net-core, image, resize, crop, scale, text watermark, animated, gif
- Description: Image resizing tool for .Net applications to resize images and add text/image watermark, Supports most common image types including animated gif.
- Author: Ziya Mollamahmut
- Date: 10-Feb-2021
- Image: https://github.com/LazZiya/Docs/raw/master/LazZiya.ImageResize/v4.0/images/lazziya-imageresize-logo.png
- Image-alt: LazZiya.ImageResize Logo
- Version: v4.0
Easily add an image watermark, change its location and opacity.
using(var img = Image.FromFile("wwwroot/images/my-image.jpg"))
{
img.AddImageWatermark("wwwroot/images/logo-watermark.png")
.SaveAs("wwwroot/images/new-image.jpg");
}
- Watermark image parameter can be a string or an
Image
file. AddImageWatermark
can be overloaded with an additional optional parameter:ImageWatermarkOptions
- All methods can be combined with resize methods:
using (var img = Image.FromStream(stream))
{
var imOps = new ImageWatermarkOptions
{
Opacity = 35,
Location = TargetSpot.Center
};
img.ScaleAndCrop(600, 300)
.AddImageWatermark("wwwroot/images/icon.png", imOps)
.SaveAs("wwwroot/upload/new-image.jpg");
}