dlemstra / dlemstra/Magick.NET
32bit exr file has incorrect bitdepth of 16.
- Dominant language
- C#
- Stars
- 4k
- Forks
- 451
- Avg merge
- 11h 55m
- Merged PRs (30d)
- 3
Description
[bug.zip](https://github.com/dlemstra/Magick.NET/files/3355302/bug.zip)
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of Magick.NET
- [x] I have searched [open](https://github.com/dlemstra/Magick.NET/issues) and [closed](https://github.com/dlemstra/Magick.NET/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
I have a 32bit exr file with values [0-1]. When opened in Photoshop it says 32 bit / channel under Image - Mode.
When loading this image with Magick.NET-Q16-HDRI-AnyCPU the _Depth_ property or _BitDepth_ method both return 16. When I attempt to save this file as a .tif it saves a 16bit tif.
I can save a correct looking 32bit tiff by first setting the depth to 32 and then saving it again.
The ColorType is set to TrueColorAlpha, but when I set it to TrueColorAlpha again the pixel values in the 32bit tiff (or 16bit) have changed. I don't understand why this is happening? I set TrueColorAlpha because otherwise single channel true color images are saved as 8-bit indexed as reported here: https://github.com/dlemstra/Magick.NET/issues/376.
### Steps to Reproduce
```
var image = new MagickImage(@"E:\magick\exr\bug.exr");
image.Depth.Dump(); //16
image.BitDepth().Dump(); //16
var tiffWriteDefines = new TiffWriteDefines { Alpha = TiffAlpha.Unspecified };
image.Write(@"E:\magick\exr\out_bug.tif", tiffWriteDefines); // 16 bit tiff
image.BitDepth(32); // force 32bit
image.Write(@"E:\magick\exr\out_bug_force_32.tif", tiffWriteDefines); // 32 bit tiff
```
ColorType issues:
```
// I would imagine this has no effect... but it does.
if (image.ColorType == ColorType.TrueColorAlpha)
{
image.ColorType = ColorType.TrueColorAlpha;
}
image.Write(@"E:\magick\exr\out_bug_color_type.tif", tiffWriteDefines); // looks different.
```
### System Configuration
- Magick.NET version: 7.14.0.2
- Environment (Operating system, version and so on): Windows 10
- Additional information:
Contributor guide
Assessment
This issue has not been assessed yet.