dlemstra / Magick.NET

The .NET library for ImageMagick
Apache License 2.0
3.34k stars 405 forks source link

EXR images with more than 4 channels return the first 4 channels only #1610

Closed vanka78bg closed 2 months ago

vanka78bg commented 2 months ago

Magick.NET version

13.6.0

Environment (Operating system, version and so on)

Windows 11

Description

I am trying to read an EXR image file with more than 4 channels. The image is generated from rendering a 3D scene and contains the regular red, green, blue, alpha channels and some additional channels for depth, object ID, material ID etc. When reading the image with Magick.NET, only the first channels are returned.

Steps to Reproduce

Run the following code snippet with the attached sample image:

using var image = new MagickImage("Image.exr");

Console.WriteLine(image.ChannelCount);

The image contains 11 channels, but only the first 4 are returned. You can verify that by opening the same image in some program that supports EXR, such as Krita, Blender etc.

Image.zip

dlemstra commented 2 months ago

There is currently no support for reading other channels than RGBA with our OpenEXR implementation. They have provided a new api that we could use but that will require some changes in ImageMagick. It will probably take a while before we can add support for this.

dlemstra commented 2 months ago

I have created a patch for ImageMagick to add support for reading meta channels in the EXR coder. This still needs some more testing but should become available in the next release.