C# 如何使用ImageProcessor类库

C# 如何使用ImageProcessor类库,c#,asp.net,C#,Asp.net,嘿,伙计们,我可以知道如何使用图像处理器类库吗?我登录了提供商网站“”,但使用它没什么好处。非常感谢你们的时间,伙计们,非常感谢你们在他们的网站上提供的帮助,有一个关于ImageFactory类的文档,其中包含每个方法的演示代码并显示结果。 你可以在这里找到它: 以下是从他们的文档中获取的完整示例,用于加载图像并对其执行一些操作并保存图像: byte[] photoBytes = File.ReadAllBytes(file); // Format is automatically detect

嘿,伙计们,我可以知道如何使用图像处理器类库吗?我登录了提供商网站“”,但使用它没什么好处。非常感谢你们的时间,伙计们,非常感谢你们在他们的网站上提供的帮助,有一个关于ImageFactory类的文档,其中包含每个方法的演示代码并显示结果。 你可以在这里找到它:

以下是从他们的文档中获取的完整示例,用于加载图像并对其执行一些操作并保存图像:

byte[] photoBytes = File.ReadAllBytes(file);
// Format is automatically detected though can be changed.
ISupportedImageFormat format = new JpegFormat { Quality = 70 };
Size size = new Size(150, 0)
using (MemoryStream inStream = new MemoryStream(photoBytes))
{
    using (MemoryStream outStream = new MemoryStream())
    {
        // Initialize the ImageFactory using the overload to preserve EXIF metadata.
        using (ImageFactory imageFactory = new ImageFactory(preserveExifData:true))
        {
            // Load, resize, set the format and quality and save an image.
            imageFactory.Load(inStream)
                        .Resize(size)
                        .Format(format)
                        .Save(outStream);
        }
        // Do something with the stream.
    }
}
以下是他们文档中的一个示例: 更改背景颜色:

public ImageFactory BackgroundColor(Color color)
裁剪图像:

public ImageFactory Crop(Rectangle rectangle)
更改重新定位:

public ImageFactory Resolution(300, 300)
将水印添加到图像:

public ImageFactory Watermark (TextLayer textLayer)

还有更多。只需导航到url,您就会找到所有这些内容。

我非常感谢您的帮助,也非常感谢您抽出时间