TinyEXR.NET 1.1.0

dotnet add package TinyEXR.NET --version 1.1.0
                    
NuGet\Install-Package TinyEXR.NET -Version 1.1.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="TinyEXR.NET" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TinyEXR.NET" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TinyEXR.NET" />
                    
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 TinyEXR.NET --version 1.1.0
                    
#r "nuget: TinyEXR.NET, 1.1.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 TinyEXR.NET@1.1.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=TinyEXR.NET&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TinyEXR.NET&version=1.1.0
                    
Install as a Cake Tool

TinyEXR.NET

Test

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 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, and HTJ2K256.
  • V3 deep compression support for NONE, RLE, ZIPS, and ZIP.
  • Layer- and multiview-aware helpers such as EXRLayers and LoadEXRWithLayer, 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.V3 reader/writer APIs for multipart, mip/rip, flat/deep, partial block reads, bounded-memory streaming writes, synchronous/asynchronous data sources, cancellation, and WouldBlock resume.
  • 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, .cube 3D 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 UnsupportedFeature when 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, and EXRLayers are still the recommended entry points, so code that only uses these helpers usually needs little or no change.
  • IsExr and IsExrFromMemory are now IsEXR and IsEXRFromMemory.
  • TinyEXR.Native.* and TinyEXR.Native.EXRNative are gone. The library is now a pure managed C# implementation, so the old native-runtime, P/Invoke, and static-link workflow from v0.3.x no longer applies.
  • Native-style structs are replaced by managed types such as ExrVersion, ExrHeader, ExrImage, ExrMultipartHeader, ExrMultipartImage, ExrDeepImage, and ExrBox2i.
  • Low-level read/write calls are now managed out-based APIs instead of ref-based native mutation. For example, ParseEXRHeaderFromFile(path, ref version, ref header) becomes ParseEXRHeaderFromFile(path, out ExrVersion version, out ExrHeader header), and LoadEXRImageFromFile(ref image, ref header, path) becomes LoadEXRImageFromFile(path, header, out ExrImage image).
  • SaveEXRImageToMemory also changed shape: v0.3.x returned byte[]?, while the current API returns ResultCode and writes the payload to out 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

  • 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
Loading failed

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.