✅ Project status: active. What does it mean?
QoiSharp is an implementation of the QOI format for fast, lossless image compression
Supported functionality:
- Encoding
- Decoding
- Encoder stream
- Decoder stream
- Unittests with 100% code coverage
- Benchmarks
Install stable releases via Nuget
| Package Name | Release (NuGet) |
|---|---|
QoiSharp |
Prefere the encoding stream to the byte array encoder for maximal performance
int width = 1920;
int height = 1080;
var channels = Channels.RgbWithAlpha;
var pixelStream = GetRawPixelStream();
Stream qoiDataStream = new QoiEncoderStream(pixelStream, new Size(width, height),channels);
byte[] data = GetRawPixels();
byte[] qoiData = QoiEncoder.Encode(new QoiImage(data, width, height, channels));Prefere the byte array decoder to the decoding stream for maximal performance, if you have the memory
var qoiImage = QoiDecoder.Decode(qoiData);
Console.WriteLine($"Width: {qoiImage.Width}");
Console.WriteLine($"Height: {qoiImage.Height}");
Console.WriteLine($"Channels: {qoiImage.Channels}");
Console.WriteLine($"Color space: {qoiImage.ColorSpace}");
Console.WriteLine($"Data length: {qoiImage.Pixels.Length}");
Stream decoderStream = new QoiDecoderStream(new MemoryStream(qoiImage));
Console.WriteLine($"Width: {decoderStream.Width}");
Console.WriteLine($"Height: {decoderStream.Height}");
Console.WriteLine($"Channels: {decoderStream.Channels}");
Console.WriteLine($"Color space: {decoderStream.ColorSpace}");QoiSharp is licensed under the MIT license.