TinyEXR.NET 0.2.3

.NET Standard 2.1
NuGet\Install-Package TinyEXR.NET -Version 0.2.3
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.
dotnet add package TinyEXR.NET --version 0.2.3
<PackageReference Include="TinyEXR.NET" Version="0.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TinyEXR.NET --version 0.2.3
#r "nuget: TinyEXR.NET, 0.2.3"
#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.2.3

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

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

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

Simple read/write

TinyEXR.Exr.LoadFromFile("114514.exr", out var rgba, out int width, out int height);

float[] data = new float[1919 * 810 * 3];
TinyEXR.Exr.SaveToFile(data, 1919, 810, 3, false, "a.exr");

Read layer file

TinyEXR.Exr.LoadFromFileWithLayers("4396.exr", "777", out var rgba, out int width, out int height);

Read single part file

using var image = new TinyEXR.ExrImageReader("0721.exr");
var b = image.GetPixels(0);
var g = image.GetPixels(1);
var r = image.GetPixels(2);

Write scanline file

var save = new ExrImageWriter(3, image.Width, image.Height);
save.SetChannel(0, "B", b);
save.SetChannel(1, "G", g);
save.SetChannel(2, "R", r);
var result = save.WriteToFile("1551.exr");

Development build

Windows

my environment is:

  • MSVC v143
  • CMake
  • .NET 6
cd TinyEXR.Native
mkdir build
cd build
cmake ..
xcopy /Y zlib\zconf.h ..
cmake --build . --config Release
xcopy /Y Release\TinyEXR.Native.dll ..\..\TinyEXR.NET\Assets\runtimes\win-x64\native
cd ..\..\TinyEXR.NET
dotnet build --configuration Release

Linux

my environment is:

  • clang 14
  • CMake
  • .NET 6
cd TinyEXR.Native/zlib
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang-14 -DCMAKE_C_FLAGS="-fPIC"
cmake --build . --config Release
sudo make install
cd ../../
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14
cmake --build . --config Release
cp libTinyEXR.Native.so ../../TinyEXR.NET/Assets/runtimes/linux-x64/native/
dotnet build --configuration Release

if you have installed zlib, you can skip some step

Details

I use CppSharp to generate binding code. Then write glue code by hand, because generated code are too heavy...

CppSharp does not generate struct defined by tinyexr. So, to make CppSharp happy, I separate the definition and implementation of tinyexr. It's too troublesome. Is there a simpler way?

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
.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 66 8/19/2022
0.2.2 64 8/16/2022
0.2.1 65 8/15/2022
0.2.0 61 8/14/2022
0.1.1 64 7/24/2022
0.1.0 81 7/15/2022
0.0.2-alpha.2 55 7/14/2022
0.0.2-alpha.1 53 7/14/2022

update tinyexr