简介
SixLabors.ImageSharp 是支持 .NET Core 的图像处理包。通过它可以实现图像裁剪、缩放和加水印等一系列图像处理功能。
相关资源:
- GitHub 地址
- NuGet
- Documentation
- Samples
简单使用
制作缩略图并打水印。
注:需安装 SixLabors.ImageSharp.Drawing 才能加水印文字或图像。 ```csharp using System; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing; using SixLabors.Primitives;
namespace SixLabors.Tests { class Program { static void Main(string[] args) { ImageProcessing(); Console.ReadKey(); }
private static void ImageProcessing()
{
using (var waterMark = Image.Load("watermark.png"))
using (var image = Image.Load("simple.jpg"))
{
image.Mutate(i => i
.Resize(200, 200)
.DrawImage(waterMark, 0.8F, new Point(120, 160)));
image.Save("wrapped.jpg");
}
}
}
} ```
Simple:
Watermark:
Processed:
闭源限制
引用自 SixLabors/ImageSharp License:
- ImageSharp is licensed under the GNU Affero General Public License v3
- An alternative Commercial License can be purchased for Closed Source projects and applications. Please visit https://sixlabors.com/pricing for details.
- Open Source projects who have taken a dependency on ImageSharp prior to adoption of the AGPL v3 license are permitted to use ImageSharp (including all future versions) under the previous Apache 2.0 License.
简单来说就是不限制开源项目和个人调试使用,但闭源项目和软件使用需购买年度 License。