diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 474e91a43b..f00cc0eaa0 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -213,6 +213,7 @@ public sealed class Configuration
/// .
/// .
/// .
+ /// .
///
/// The default configuration of .
internal static Configuration CreateDefaultInstance() => new(
@@ -223,5 +224,6 @@ public sealed class Configuration
new PbmConfigurationModule(),
new TgaConfigurationModule(),
new TiffConfigurationModule(),
- new WebpConfigurationModule());
+ new WebpConfigurationModule(),
+ new ExrConfigurationModule());
}
diff --git a/tests/ImageSharp.Tests/Formats/Exr/ExrDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Exr/ExrDecoderTests.cs
new file mode 100644
index 0000000000..709a442630
--- /dev/null
+++ b/tests/ImageSharp.Tests/Formats/Exr/ExrDecoderTests.cs
@@ -0,0 +1,54 @@
+// Copyright (c) Six Labors.
+// Licensed under the Six Labors Split License.
+
+using SixLabors.ImageSharp.Formats.OpenExr;
+using SixLabors.ImageSharp.PixelFormats;
+
+namespace SixLabors.ImageSharp.Tests.Formats.Exr;
+
+[Trait("Format", "Exr")]
+[ValidateDisposedMemoryAllocations]
+public class ExrDecoderTests
+{
+ private static ExrDecoder ExrDecoder => new();
+
+ [Theory]
+ [WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)]
+ public void ExrDecoder_CanDecode_Uncompressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ using Image image = provider.GetImage(ExrDecoder);
+ image.DebugSave(provider);
+ image.CompareToOriginal(provider);
+ }
+
+ [Theory]
+ [WithFile(TestImages.Exr.Zip, PixelTypes.Rgba32)]
+ public void ExrDecoder_CanDecode_ZipCompressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ using Image image = provider.GetImage(ExrDecoder);
+ image.DebugSave(provider);
+ image.CompareToOriginal(provider);
+ }
+
+ [Theory]
+ [WithFile(TestImages.Exr.Zips, PixelTypes.Rgba32)]
+ public void ExrDecoder_CanDecode_ZipsCompressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ using Image image = provider.GetImage(ExrDecoder);
+ image.DebugSave(provider);
+ image.CompareToOriginal(provider);
+ }
+
+ [Theory]
+ [WithFile(TestImages.Exr.Rle, PixelTypes.Rgba32)]
+ public void ExrDecoder_CanDecode_RunLengthCompressed(TestImageProvider provider)
+ where TPixel : unmanaged, IPixel
+ {
+ using Image image = provider.GetImage(ExrDecoder);
+ image.DebugSave(provider);
+ image.CompareToOriginal(provider);
+ }
+}
diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs
index 676d460e56..8922e3ebee 100644
--- a/tests/ImageSharp.Tests/TestImages.cs
+++ b/tests/ImageSharp.Tests/TestImages.cs
@@ -998,4 +998,12 @@ public static class TestImages
public const string RgbPlainNormalized = "Pbm/rgb_plain_normalized.ppm";
public const string RgbPlainMagick = "Pbm/rgb_plain_magick.ppm";
}
+
+ public static class Exr
+ {
+ public const string Uncompressed = "Exr/Calliphora_uncompressed.exr";
+ public const string Zip = "Exr/Calliphora_zip.exr";
+ public const string Zips = "Exr/Calliphora_zips.exr";
+ public const string Rle = "Exr/Calliphora_rle.exr";
+ }
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
index 89b43a0661..758d689025 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.Formats.cs
@@ -5,6 +5,7 @@ using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.Formats.Jpeg;
+using SixLabors.ImageSharp.Formats.OpenExr;
using SixLabors.ImageSharp.Formats.Pbm;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Formats.Tga;
@@ -59,12 +60,13 @@ public static partial class TestEnvironment
new PbmConfigurationModule(),
new TgaConfigurationModule(),
new WebpConfigurationModule(),
- new TiffConfigurationModule());
+ new TiffConfigurationModule(),
+ new ExrConfigurationModule());
IImageEncoder pngEncoder = IsWindows ? SystemDrawingReferenceEncoder.Png : new ImageSharpPngEncoderWithDefaultConfiguration();
IImageEncoder bmpEncoder = IsWindows ? SystemDrawingReferenceEncoder.Bmp : new BmpEncoder();
- // Magick codecs should work on all platforms
+ // Magick codecs should work on all platforms.
cfg.ConfigureCodecs(
PngFormat.Instance,
MagickReferenceDecoder.Instance,
diff --git a/tests/Images/Input/Exr/Calliphora_rle.exr b/tests/Images/Input/Exr/Calliphora_rle.exr
new file mode 100644
index 0000000000..20878f8896
--- /dev/null
+++ b/tests/Images/Input/Exr/Calliphora_rle.exr
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6302e72676f5574b8a9dde7e4385cff1c115e9833b630118328b88aea07e31d0
+size 4098454
diff --git a/tests/Images/Input/Exr/Calliphora_uncompressed.exr b/tests/Images/Input/Exr/Calliphora_uncompressed.exr
new file mode 100644
index 0000000000..f0003a1f91
--- /dev/null
+++ b/tests/Images/Input/Exr/Calliphora_uncompressed.exr
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:71613ff5972fa9e7b405ac944d159d1791ad229f5560da616438c9d718eafd24
+size 5798633
diff --git a/tests/Images/Input/Exr/Calliphora_zip.exr b/tests/Images/Input/Exr/Calliphora_zip.exr
new file mode 100644
index 0000000000..5d17150a49
--- /dev/null
+++ b/tests/Images/Input/Exr/Calliphora_zip.exr
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:92c78a7cf9fce29e725511acadf49f0f784914da5bef55b0e0c4e75ba09c3a75
+size 2652397
diff --git a/tests/Images/Input/Exr/Calliphora_zips.exr b/tests/Images/Input/Exr/Calliphora_zips.exr
new file mode 100644
index 0000000000..b4b2976822
--- /dev/null
+++ b/tests/Images/Input/Exr/Calliphora_zips.exr
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3e34a9b0bb7fd6eb24eef633dea737653812fd8ab5c5352f6e10523055823b1d
+size 2918571