https://github.com/add-sp/easywatermark
方便地为图片添加水印的库。 A library to add watermarks to pictures.
https://github.com/add-sp/easywatermark
dll library watermark
Last synced: about 1 year ago
JSON representation
方便地为图片添加水印的库。 A library to add watermarks to pictures.
- Host: GitHub
- URL: https://github.com/add-sp/easywatermark
- Owner: ADD-SP
- License: mit
- Created: 2020-02-14T09:08:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T16:55:34.000Z (over 6 years ago)
- Last Synced: 2025-05-06T00:06:28.657Z (about 1 year ago)
- Topics: dll, library, watermark
- Language: C#
- Homepage:
- Size: 66.4 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EasyWatermark
方便地为图片添加水印的库。默认添加到右下角。坐标系原点也为右下角。
A library that can add watermark at specified coordinates. The default position is the lower right corner. The origin of the coordinate is in the lower right corner.
# Build
On Windows:
```powershell
dotnet bulid -c Release
```
# How to use
引用"EasyWatermark.dll"后添下列代码即可。
You should reference "EasyWatermark.dll" to your project and add the following code:
```C#
using EasyWatermark;
```
# Example
原图如下(图片来自网络):
Take this picture as an example:

## First
给target.jpg的右下角添加一行字,内容为“Hello World”,字体为“思源宋体 CN Heavy”,字体大小50像素,白色,透明度200,处理后的图片保存为“result0.jpg”。
The watermark content is “Hello World”, the font is “思源宋体 CN Heavy”, the size is 50 pixels, the color is white, and the alpha is 200.
```C#
Image watermark = EWatermark.GetWatermark("Hello World", 50, new FontFamily("思源宋体 CN Heavy"), Color.White, 200);
Image result = EWatermark.AddWatermark("target.jpg", watermark);
result.Save("result0.jpg", ImageFormat.Jpeg);
```

## Second
```C#
Image watermark = EWatermark.GetWatermark("测试用水印", 50, new FontFamily("思源宋体 CN Heavy"), Color.White, 200);
Image result = EWatermark.AddWatermark("target.jpg", watermark);
result.Save("result1.jpg", ImageFormat.Jpeg);
```

## Third
以watermark.jpg为水印图片为target.jpg打上水印。
Use “watermark.jpg” as a watermark picture to watermark “target.jpg”.
```C#
Image result = EWatermark.AddWatermark("target.jpg", "watermark.jpg");
result.Save("result.jpg", ImageFormat.Jpeg);
```
# Note
+ 这个库的性能较低,建议应用于性能不敏感的场景。
+ The performance of this library is not good, it is recommended to use it as needed.