Sdcb.SimdCodecs.Qoi 1.2.0

Prefix Reserved
dotnet add package Sdcb.SimdCodecs.Qoi --version 1.2.0
                    
NuGet\Install-Package Sdcb.SimdCodecs.Qoi -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sdcb.SimdCodecs.Qoi" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sdcb.SimdCodecs.Qoi" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Sdcb.SimdCodecs.Qoi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sdcb.SimdCodecs.Qoi --version 1.2.0
                    
#r "nuget: Sdcb.SimdCodecs.Qoi, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Sdcb.SimdCodecs.Qoi@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sdcb.SimdCodecs.Qoi&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Sdcb.SimdCodecs.Qoi&version=1.2.0
                    
Install as a Cake Tool

Sdcb.SimdCodecs.Qoi

Pure-managed QOI ("Quite OK Image") decoding and encoding for .NET 10, written from the specification at qoiformat.org. It decodes straight into the caller's buffer in any 8-bit pixel layout without allocating, and it encodes to an array or a stream.

using Sdcb.SimdCodecs.Abstractions;
using Sdcb.SimdCodecs.Qoi;

byte[] data = File.ReadAllBytes("image.qoi");
QoiInfo info = QoiDecoder.ReadInfo(data);       // size, channels, colour space
QoiImage image = QoiDecoder.Decode(data);       // RGB or RGBA, as the header declares

var bgra = new byte[info.Width * info.Height * 4];
QoiDecoder.DecodeTo(data, bgra, ImagePixelFormat.Bgra32);

Malformed data throws InvalidDataException, and the Try methods and the QoiImageDecoder adapter return false instead. Images above 2^28 pixels are refused, which bounds what a decode allocates.

Encoding

byte[] qoi = QoiEncoder.Encode(rgba, width, height, ImagePixelFormat.Rgba32);

using var file = File.Create("image.qoi");
QoiEncoder.Encode(bgr, width, height, ImagePixelFormat.Bgr24, file, QoiColorSpace.Linear);

The encoder takes RGBA, BGRA, RGB, BGR or grey input at any row stride. RGBA and BGRA input is written with 4 channels; the others are written with 3. For each pixel the encoder uses the first chunk that fits, trying them in this order: run, index, diff, luma, RGB, RGBA.

Decisions

The specification leaves these cases open. The table shows what this package does:

Case This package
The colour space byte It is reported (QoiInfo.ColorSpace; through the facade, ColorEncoding.Transfer is Linear for 1). It never changes the decoded values.
A 3-channel image whose chunks carry alpha (an RGBA chunk, or an index slot that was never filled) The alpha is ignored: every pixel is opaque, as the header declares.
A run longer than the pixels left The image ends and the rest of the run is ignored.
The 8-byte end marker It is not checked. The stream must contain every pixel, and data after the last chunk is ignored.
Width or height 0, channels other than 3 or 4, colour space above 1 Refused.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sdcb.SimdCodecs.Qoi:

Package Downloads
Sdcb.SimdCodecs

Image-codec facade over the Sdcb.SimdCodecs family: sniff a byte stream's format by its magic-byte signature and dispatch to the matching decoder (PNG, JPEG, TIFF, JBIG2, JPEG 2000, WebP, GIF, BMP, ICO, CUR, QOI, PBM / PGM / PPM / PAM, PFM), returning a codec-neutral IDecodedImage (fidelity tier: native bit depth + ColorEncoding colour signalling, with a ToFloats() RGBA float32 view) or decoding zero-copy into a caller-provided 8-bit RGBA buffer (display tier, integer-sample formats). AOT-compatible.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 36 10/30/2026