我正在尝试加载-> 直接操作字节数组-> 保存 8 位 png 图像。
我想使用 ImageSharp 将其速度与我当前的库进行比较,但是在他们的代码示例中,他们需要定义像素类型(他们使用 Rgba32):
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
// Image.Load(string path) is a shortcut for our default type.
// Other pixel formats use Image.Load<TPixel>(string path))
using (Image<Rgba32> image = Image.Load("foo.jpg"))
{
image.Mutate(x => x
.Resize(image.Width / 2, image.Height / 2)
.Grayscale());
image.Save("bar.jpg"); // Automatic encoder selected based on extension.
}
我查看了像素类型:https ://github.com/SixLabors/ImageSharp/tree/master/src/ImageSharp/PixelFormats
但是没有灰度 8 位像素类型。