小编Par*_*jah的帖子

使用 SixLabors.ImageSharp 在 C# 中创建 Image 的新实例

我正在尝试使用 SixLabors.Imagesharp 创建 Image 类的新实例,但出现错误。我使用的系统使用旧的 ImageSharp,我们想更新 nuget 包并使用 SixLabors.ImageSharp 代替。

代码曾经是这样的:OLD Code with ImageSharp:

var resultImage = new Image<Rgba32>(outputImageWidth, outputImageHeight);
Run Code Online (Sandbox Code Playgroud)

我尝试用 SixLabors.ImageSharp 编写的新代码完全相同,但这次我得到了按摩:

Severity Code Description   Project File Linem Suppression State
Error CS0315 The type 'SixLabors.ImageSharp.PixelFormats.Rgba32' cannot be used as type parameter 'TPixel' in the generic type or method 'Image<TPixel>'. There is no boxing conversion from 'SixLabors.ImageSharp.PixelFormats.Rgba32' to '?'.
Run Code Online (Sandbox Code Playgroud)

我尝试了很多其他方法来创建新图像,但都失败了。您知道如何使用 SixLabors.Imagesharp 创建新图像吗?

c# asp.net imagesharp

4
推荐指数
1
解决办法
6444
查看次数

标签 统计

asp.net ×1

c# ×1

imagesharp ×1