SharpAstro.Codecs.Abstractions
3.6.551
dotnet add package SharpAstro.Codecs.Abstractions --version 3.6.551
NuGet\Install-Package SharpAstro.Codecs.Abstractions -Version 3.6.551
<PackageReference Include="SharpAstro.Codecs.Abstractions" Version="3.6.551" />
<PackageVersion Include="SharpAstro.Codecs.Abstractions" Version="3.6.551" />
<PackageReference Include="SharpAstro.Codecs.Abstractions" />
paket add SharpAstro.Codecs.Abstractions --version 3.6.551
#r "nuget: SharpAstro.Codecs.Abstractions, 3.6.551"
#:package SharpAstro.Codecs.Abstractions@3.6.551
#addin nuget:?package=SharpAstro.Codecs.Abstractions&version=3.6.551
#tool nuget:?package=SharpAstro.Codecs.Abstractions&version=3.6.551
SharpAstro Codecs
A family of pure-managed, AOT-compatible image-codec packages for .NET 10 — no native binaries.
Each format ships as an independent NuGet, and SharpAstro.Codecs is a thin facade that sniffs a
byte stream by its magic bytes and dispatches to the right decoder, so a consumer can reference one
package instead of cherry-picking codecs.
Formats: PNG (read/write), JPEG (baseline + progressive decode, incl. scaled 1/2–1/8 LOD), TIFF (read/write), JPEG XR (read/write, jxrlib-exact), OpenEXR (read/write), JPEG XL (read/write), plus EXIF reading and a bundled sRGB ICC profile. See CODECS.md for the full per-package decode/encode matrix and how to pick the right one.
All packages target net10.0, are IsAotCompatible, ship SourceLink debugging, and publish in
lockstep (shared Major.Minor + CI run-number patch).
NuGet
# One facade for sniff-and-decode (PNG + JPEG today):
dotnet add package SharpAstro.Codecs
# ...or reference just the format(s) you need:
dotnet add package SharpAstro.Png
dotnet add package SharpAstro.Jxr
Usage
Decode any supported still image through the facade — sniff the header, size a buffer, decode into it:
using SharpAstro.Codecs;
var bytes = File.ReadAllBytes(path);
if (ImageCodecs.TryReadInfo(bytes, out var info))
{
var rgba = new byte[info.Width * info.Height * 4];
ImageCodecs.TryDecodeIntoRgba8(bytes, rgba); // zero-copy into your buffer
// ...or ImageCodecs.TryDecode(bytes, out IDecodedImage img) for the full-fidelity raster.
}
Each codec is also usable directly — e.g. PngReader / PngWriter, JpegDecoder.Decode / DecodeTo,
TiffReader / TiffWriter, JxrImageCodec, ExrImageCodec, JxlImageCodec. See CODECS.md.
Building from source
git clone https://github.com/SharpAstro/Codecs
cd Codecs
dotnet build Codecs.JustTests.sln -c Release
dotnet test Codecs.JustTests.sln -c Release
Requires the .NET 10 SDK.
License
Unlicense (public domain).
Credits
This repository began as a fork of StbSharp/StbImageSharp
(Roman Shapiro's C# port of Sean Barrett's stb_image.h, via the
Hebron C-to-C# transpiler). SharpAstro.Jpeg's decoder was
ported from and validated byte-exact against that reference decoder before the stb port itself was
retired from the repo.
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on SharpAstro.Codecs.Abstractions:
| Package | Downloads |
|---|---|
|
SharpAstro.Png
Pure-managed PNG encoder + decoder for .NET. Writer: adaptive per-row filter selection (libpng "minimum sum of absolute values" heuristic), 8/16-bit RGBA/Gray. Reader: chunk parsing with CRC validation, color types 0/2/4/6 at 8/16-bit. Both sides handle iCCP / sRGB / gAMA / cHRM / eXIf metadata plus PNG-3 HDR signaling chunks cICP (Coding-Independent Code Points), mDCv (Mastering Display Color Volume), cLLI (Content Light Level Info) — full HDR10 / HLG round-trip. Also exports PngPredictor as a reusable row-unfilter building block (TIFF Predictor=2 / PDF FlateDecode). AOT-compatible. |
|
|
SharpAstro.Tiff
Pure-managed TIFF reader/writer for .NET. Supports multi-page, 8/16/32-bit uint and IEEE-Float samples, Uncompressed/Deflate/ZlibPkzip, contig planar config, SampleFormat/SMin/SMax/ICC round-trip, both II and MM byte order. AOT-compatible. |
|
|
SharpAstro.Color.Icc
ICC v4 colour-management primitives for .NET image-codec consumers. Bundled sRGB v4 profile (588-byte LittleCMS-generated, ReadOnlyMemory<byte> for embedding in TIFF/PNG/JPEG) plus a WithCicp(...) helper that injects an ICC v4.4 cicp tag carrying H.273 colour-primaries / transfer-function codepoints, so HDR10, HLG, wide-gamut, and linear-scene-light signalling can be added on top of any base profile. The H.273 ColorPrimaries / TransferFunction / MatrixCoefficients enums (shared with SharpAstro.Png's PNG-3 cICP chunk) live in SharpAstro.Codecs.Abstractions as of 3.5. AOT-compatible. |
|
|
SharpAstro.Jxr
Pure-managed JPEG XR (ITU-T T.832 / ISO/IEC 29199-2) encoder/decoder for .NET. AOT-compatible. The codec core is ported faithfully from Microsoft's jxrlib reference implementation and validated bit-exactly against it (byte-for-byte vs JxrEncApp; round-trips through JxrDecApp and Windows Photo / WIC). Reuses SharpAstro.Tiff for the T.833 .jxr container. Current pipeline: single-tile spatial YUV444 BD8 RGB, lossless and lossy, all three overlap levels. |
|
|
SharpAstro.Exr
Pure-managed OpenEXR (.exr) reader/writer for .NET. Scanline images, HALF/FLOAT/UINT channels, NONE/RLE/ZIP/ZIPS/PIZ compression. AOT-compatible. |
GitHub repositories
This package is not used by any popular GitHub repositories.