简介

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(); }

  1. private static void ImageProcessing()
  2. {
  3. using (var waterMark = Image.Load("watermark.png"))
  4. using (var image = Image.Load("simple.jpg"))
  5. {
  6. image.Mutate(i => i
  7. .Resize(200, 200)
  8. .DrawImage(waterMark, 0.8F, new Point(120, 160)));
  9. image.Save("wrapped.jpg");
  10. }
  11. }
  12. }

} ```

Simple:
SixLabors.ImageSharp 处理图像 - 图1

Watermark:
SixLabors.ImageSharp 处理图像 - 图2

Processed:
SixLabors.ImageSharp 处理图像 - 图3

闭源限制

引用自 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。