Image-ImageSharp

[删除(380066935@qq.com或微信通知)]

SixLabors.ImageSharp

SixLabors/ImageSharp: A modern, cross-platform, 2D Graphics library for .NET (github.com)

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics API.

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics library. Designed to simplify image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API.


ImageSharp is designed from the ground up to be flexible and extensible. The library provides API endpoints for common image processing operations and the building blocks to allow for the development of additional operations.


Built against .NET Standard 2.0, ImageSharp can be used in device, cloud, and embedded/IoT scenarios.


ImageSharp 是一个全新的、功能齐全、完全托管的跨平台 2D 图形 API。

ImageSharp 是一个全新的、功能齐全的、完全托管的、跨平台的 2D 图形库。 旨在简化图像处理,ImageSharp 为您带来了一个非常强大但非常简单的 API。


ImageSharp 从一开始就被设计为灵活和可扩展的。 该库为常见的图像处理操作和构建块提供 API 端点,以允许开发其他操作。


基于 .NET Standard 2.0 构建的 ImageSharp 可用于设备、云和嵌入式/物联网场景。


PM > Install-Package SixLabors.ImageSharp

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
 
using var image = Image.Load("original.jpg");
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2));
image.Save("result.jpg");

using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.Metadata;
 
const int frameDelay = 42;
const int colorTableLength = 128;
const GifDisposalMethod disposalMethod = GifDisposalMethod.RestoreToBackground;
 
using var image = await Image.LoadAsync("original.gif");
foreach (ImageFrame frame in image.Frames)
{
  GifFrameMetadata metaData = frame.Metadata.GetGifMetadata();
  metaData.FrameDelay = frameDelay;
  metaData.ColorTableLength = colorTableLength;
  metaData.DisposalMethod = disposalMethod;
}
 
await image.SaveAsync("result.gif");