TinyEXR.NET
1.1.0
dotnet add package TinyEXR.NET --version 1.1.0
NuGet\Install-Package TinyEXR.NET -Version 1.1.0
<PackageReference Include="TinyEXR.NET" Version="1.1.0" />
<PackageVersion Include="TinyEXR.NET" Version="1.1.0" />
<PackageReference Include="TinyEXR.NET" />
paket add TinyEXR.NET --version 1.1.0
#r "nuget: TinyEXR.NET, 1.1.0"
#:package TinyEXR.NET@1.1.0
#addin nuget:?package=TinyEXR.NET&version=1.1.0
#tool nuget:?package=TinyEXR.NET&version=1.1.0
TinyEXR.NET
TinyEXR.NET is a pure C# port library of tinyexr
The target frameworks are net8.0, netstandard2.1
Download
TinyEXR.NET can be found on NuGet (← click it !)
Dependencies
The net8.0 target has no third-party runtime dependencies. The netstandard2.1 target depends on SharpZipLib.
Features
- full NativeAOT support!
- Single-part EXR read/write for scanline images.
- Single-part EXR read/write for tiled images, including one-level tiles and multi-resolution mipmap/ripmap layouts.
- Multipart image EXR parse/load/save for flat image parts, including single-entry multipart containers.
- Deep single-part scanline and one-level tiled EXR load through
LoadDeepEXR. - Regular image compression support for
NONE,RLE,ZIP,ZIPS,PIZ,PXR24,B44,B44A,HTJ2K32, andHTJ2K256. - V3 deep compression support for
NONE,RLE,ZIPS, andZIP. - Layer- and multiview-aware helpers such as
EXRLayersandLoadEXRWithLayer, including RGBA expansion for subsampled channels in the convenience load path. - Managed header/image models that preserve EXR metadata needed by tools and inspectors, including data/display windows, tile descriptions, custom attributes, channel sampling, line order, and long names.
- Stateful
TinyEXR.V3reader/writer APIs for multipart, mip/rip, flat/deep, partial block reads, bounded-memory streaming writes, synchronous/asynchronous data sources, cancellation, andWouldBlockresume. - V3 HTJ2K32/HTJ2K256 flat decode and genuine encode through a safe managed JPEG 2000 Part 15 implementation.
- Safe SIMD paths for pixel conversion, RGB color matrices, and ZIP/RLE byte reorder and prediction, with scalar parity fallbacks.
- V3 spectral wavelength cubes and CPU image utilities: typed pixel conversion, whole-image and streaming resize, tone mapping, color/transfer transforms,
.cube3D LUTs, planar/interleaved bridges, and luminance-chroma reconstruction. - V3 whole-part decode for mixed flat/deep multipart files. The v1-compatible flat multipart facade returns
UnsupportedFeaturewhen a part is deep.
Usage
The TinyEXR namespace keeps the public facade close to tinyexr v1. The
TinyEXR.V3 namespace exposes the new stateful object, partial-I/O, deep, and
streaming model introduced by tinyexr v3. See
TinyEXR v3 API notes for the upstream differences, managed
type mapping, migration status, and codec support matrix.
V1-compatible facade:
ResultCode load = Exr.LoadEXR(inputPath, out float[] rgba, out int width, out int height);
if (load != ResultCode.Success)
{
throw new InvalidOperationException($"LoadEXR failed: {load}");
}
Direct v3 API:
using TinyEXR.V3;
ReaderResult<Image> load = ExrFile.LoadFromFile(inputPath);
if (!load.IsSuccess || load.Value is not Image image)
{
throw new InvalidOperationException($"EXR load failed: {load.Status}", load.Error);
}
Part firstPart = image.Parts[0];
PartLevel baseLevel = firstPart.GetLevel(0, 0);
Console.WriteLine(
$"{firstPart.Header.PartType}: {baseLevel.Width}x{baseLevel.Height}, " +
$"{baseLevel.Channels.Count} channels");
WriterResult save = ExrFile.SaveToFile(image, outputPath, Compression.ZIP);
if (!save.IsSuccess)
{
throw new InvalidOperationException($"EXR save failed: {save.Status}", save.Error);
}
Samples
The repository currently includes TinyEXR.Viewer, an Avalonia sample built on top of TinyEXR.NET.
The viewer is intended for manual EXR inspection: it can open EXR files from the file picker, drag and drop, or a command-line path, preview single-part images and pure-image multipart files, switch between parts/layers/levels when decoded image data is available, and display metadata such as version flags, windows, tile information, channels, custom attributes, and deep-image statistics.
See Samples/TinyEXR.Viewer/README.md for run instructions and the current feature boundaries.
Test
The current test suite covers the main supported surface of the library across both target outputs: the default target path and the netstandard2.1 fallback path run the same shared test cases.
See Test/README.md for the current test layout and execution details.
Benchmark
The current compression benchmark compares TinyEXR.NET v3, the complete
vendored TinyEXR v3 C library, and OpenEXR 3.4.13 on the same deterministic
1920x1080 RGBA HALF image. The 2026-07-26 run used BenchmarkDotNet's normal
DefaultJob and clang-cl 22.1.3 native builds. Every timed operation includes
result allocation and complete in-memory encode/decode, while preparation,
validation, and result release are excluded.
Representative means are encode ms / decode ms:
| Compression | TinyEXR.NET v3 | TinyEXR v3 C | OpenEXR 3.4.13 |
|---|---|---|---|
| None | 5.89 / 3.46 | 6.71 / 4.44 | 6.82 / 3.28 |
| RLE | 16.54 / 7.37 | 17.07 / 8.03 | 16.22 / 14.74 |
| ZIPS | 17.88 / 7.54 | 24.72 / 9.45 | 37.06 / 7.70 |
| ZIP | 11.08 / 5.45 | 19.64 / 6.43 | 22.75 / 4.55 |
| PIZ | 38.99 / 28.59 | 49.72 / 24.71 | 40.49 / 15.01 |
| PXR24 | 15.91 / 12.69 | 16.17 / 7.60 | 19.63 / 5.26 |
| HTJ2K256 | 104.28 / 82.23 | 47.77 / 33.53 | 30.35 / 24.07 |
| HTJ2K32 | 104.95 / 81.37 | 39.31 / 24.45 | 52.44 / 39.86 |
Managed encode is the fastest of the three implementations for NONE, ZIP,
ZIPS, and PIZ, with RLE and PXR24 close to both native libraries.
Managed decode leads on RLE and ZIPS. The native libraries remain
substantially faster for B44/B44A and for HTJ2K in both directions.
See Benchmark/README.md for the complete timing,
throughput, allocation, encoded-size, build, fairness, and MSVC compatibility
report.
Versioning
Starting with v1.0, TinyEXR.NET is a pure C# implementation of the tinyexr-compatible API surface.
The legacy v0.3.x line is kept as a maintenance branch. It may continue to receive compatibility fixes and follow tinyexr updates when needed, but no new features will be added to v0.3.x.
The main branch moves forward with v1.0+.
For new development, prefer the mainline v1.0+ branch. Use the v0.3.x maintenance branch only if you need the legacy native-wrapper line for compatibility reasons.
Upgrade from v0.3.x
- High-level RGBA helpers such as
LoadEXR,LoadEXRFromMemory,SaveEXR,SaveEXRToMemory,LoadEXRWithLayer, andEXRLayersare still the recommended entry points, so code that only uses these helpers usually needs little or no change. IsExrandIsExrFromMemoryare nowIsEXRandIsEXRFromMemory.TinyEXR.Native.*andTinyEXR.Native.EXRNativeare gone. The library is now a pure managed C# implementation, so the old native-runtime, P/Invoke, and static-link workflow fromv0.3.xno longer applies.- Native-style structs are replaced by managed types such as
ExrVersion,ExrHeader,ExrImage,ExrMultipartHeader,ExrMultipartImage,ExrDeepImage, andExrBox2i. - Low-level read/write calls are now managed
out-based APIs instead ofref-based native mutation. For example,ParseEXRHeaderFromFile(path, ref version, ref header)becomesParseEXRHeaderFromFile(path, out ExrVersion version, out ExrHeader header), andLoadEXRImageFromFile(ref image, ref header, path)becomesLoadEXRImageFromFile(path, header, out ExrImage image). SaveEXRImageToMemoryalso changed shape:v0.3.xreturnedbyte[]?, while the current API returnsResultCodeand writes the payload toout byte[] encoded.
Known Limitation
The V3 reader materializes mixed flat/deep multipart files. The v1-compatible LoadEXRMultipartImage* model can represent only flat ExrImage parts, so it returns UnsupportedFeature when any part is deep; use TinyEXR.V3.ExrReader for those files. Likewise, v1 ExrDeepImage has no mip/rip level dimension, so LoadDeepEXR* accepts one-level deep tiles and rejects multilevel deep tiles.
The V3 reader and writer decode and genuinely encode flat HTJ2K32/HTJ2K256 payloads. Compressed deep HTJ2K data and compressed DWAA/DWAB remain intentionally unsupported, matching upstream v3 policy.
License
TinyEXR.NET is under MIT license
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SharpZipLib (>= 1.4.2)
-
net8.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on TinyEXR.NET:
| Package | Downloads |
|---|---|
|
ValveResourceFormat
Parser, decompiler, and exporter for Valve's Source 2 resource file formats. Supports models, textures, materials, maps, particles, and more. |
|
|
Aardvark.GeoSpatial.Opc
Aardvark.GeoSpatial.Opc formerly known as Aardvark.VRVis.Internal |
|
|
UAI_ONNX
ONNX Runner built for C# projects that target .Net8.0 or later. This library is built on top of the ONNX Runtime C# API and provides a simple way to load and run ONNX models in C#. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on TinyEXR.NET:
| Repository | Stars |
|---|---|
|
ValveResourceFormat/ValveResourceFormat
Source 2 Viewer is an all-in-one tool to browse VPK archives, view, extract, and decompile Source 2 assets, including maps, models, materials, textures, sounds, and more.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 861 | 7/26/2026 |
| 1.0.0 | 5,151 | 5/3/2026 |
| 1.0.0-rc1 | 120 | 4/21/2026 |
| 0.3.13 | 279 | 4/18/2026 |
| 0.3.12 | 136 | 4/17/2026 |
| 0.3.11 | 21,514 | 8/14/2025 |
| 0.3.10 | 3,508 | 4/27/2025 |
| 0.3.9 | 1,241 | 2/13/2025 |
| 0.3.8 | 2,493 | 9/17/2024 |
| 0.3.7 | 1,524 | 8/4/2024 |
| 0.3.6 | 1,160 | 2/23/2024 |
| 0.3.5 | 525 | 8/7/2023 |
| 0.3.4 | 457 | 7/9/2023 |
| 0.3.3 | 344 | 6/6/2023 |
| 0.3.2 | 619 | 4/19/2023 |
| 0.3.1 | 409 | 4/4/2023 |
| 0.2.3 | 826 | 8/19/2022 |
| 0.2.2 | 623 | 8/16/2022 |
| 0.2.1 | 867 | 8/15/2022 |
| 0.2.0 | 602 | 8/14/2022 |
Adds a pure managed TinyEXR v3 API with immutable image and header models, whole and partial reads, synchronous and asynchronous streaming I/O, multipart and mipmap/ripmap support, flat and deep image read/write, HTJ2K32/HTJ2K256 encoding/decoding, safe SIMD acceleration, spectral and image-processing utilities, and migration of compatible v1 facade paths onto the v3 core. Retains NativeAOT, net8.0, and netstandard2.1 support.