TinyEXR.NET 0.1.1

.NET Standard 2.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package TinyEXR.NET --version 0.1.1
NuGet\Install-Package TinyEXR.NET -Version 0.1.1
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="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TinyEXR.NET --version 0.1.1
#r "nuget: TinyEXR.NET, 0.1.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TinyEXR.NET as a Cake Addin
#addin nuget:?package=TinyEXR.NET&version=0.1.1

// Install TinyEXR.NET as a Cake Tool
#tool nuget:?package=TinyEXR.NET&version=0.1.1

TinyEXR.NET

TinyEXR.NET is a C# wrapper of single header-only C++ library tinyexr

tinyexr is a portable single header-only C++ library to load and save OpenEXR (.exr) images

The target framework of TinyEXR.NET is .NET Standard 2.1

The goal of this library is easy to use. Therefore, API is very simple (not flexible).

Download

TinyEXR.NET can be found on NuGet NuGet (← click it !)

Supported Platforms

Key:

  • ✅: completed
  • 🚧: work in progress
  • ⌛: planned, not yet started
  • ❌: no plan
Platform State
Windows x64 🚧
Linux x64

Unlisted platforms are also unplanned.

But you can contribute to support any other platform! 😃

Usage

Load from file

ResultType loadResult = OpenExr.Load(@"D:\hello.exr", out float[] rgba, out var w, out var h);

rgba format is: float x RGBA x width x hight

Save to file

float[] rgb = new float[w * h * 3];
ResultType saveResult = OpenExr.Save(rgb, w, h, 3, false, @"D:\hello.exr");

image image format is: float x width x height, or float x RGB(A) x width x hight

components must be 1(Grayscale), 3(RGB) or 4(RGBA).

Get Layers

ResultType r = OpenExr.GetLayers(@"D:\hello.exr", out string[] layers);

I can't find an image with layers...I don't know if this function works...It may cause bugs 😃

Development build

Windows

0. Requirements
  • MSVC that supported C++11 (recommend VS2019 or higher)
  • Powershell (>= 3.0)
  • CMake (>= 3.0.0)
  • .NET SDK x64 (>= .NET Core 3.0)
1. Download the code

First, clone this project or download the latest release and unzip.

2. Build native library

Run build_win-x64.ps1

3. Finish

Finally, we can find NuGet package in TinyEXR.NET\bin\Release. You can use it anywhere

Details

Although tinyexr provides C interface, the MSVC compiler does not export any symbols by default.

So we have to create a C++ project in the folder native to wrap tinyexr API.

I don't know if there is any better way. But it works. 😃

The reason why we only support x64 platform is that I don't know whether the existing code will work properly if we support x86 or other platforms. Specifically, Is the struct layout at C++ side consistent with C# side? I don't have time to solve this problem at present. So I just give up these platform.

Contribution is welcome!

License

TinyEXR.NET is under MIT license

and wrapped C++ lib tinyexr is under 3-clause BSD

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.3 160 8/19/2022
0.2.2 151 8/16/2022
0.2.1 152 8/15/2022
0.2.0 148 8/14/2022
0.1.1 151 7/24/2022
0.1.0 167 7/15/2022
0.0.2-alpha.2 60 7/14/2022
0.0.2-alpha.1 58 7/14/2022

New API: GetLayers