This project has moved and is read-only. For the latest updates, please go here.

Channel depth is always 1 in 6.8.7

Oct 3, 2013 at 5:12 PM

It seems that extracting the channel depth no longer works. This is the code:
using (MagickImage img = new MagickImage(@"C:\Temp\rgba16bpc.png"))
    int depthR = img.Depth(Channels.Red);
    int depthG = img.Depth(Channels.Green);
    int depthB = img.Depth(Channels.Blue);
    int depthA = img.Depth(Channels.Alpha);

    System.Diagnostics.Debug.WriteLine(string.Format("{0} {1} {2} {3}",
        depthR, depthG, depthB, depthA));
And here is the image:

Running this with Magick.NET- will result in:
16 16 16 16
Running this with Magick.NET- will result in:
1 1 1 1
The same behaviour is observed with 8 bit per channel images. 6.8.6 will say it's all "8" and 6.8.7 will say it's all "1".

Was there a change I should be aware of?

Thank you,
Oct 3, 2013 at 9:00 PM
Edited Oct 3, 2013 at 9:12 PM
I should be 16 instead of 1. I just tried debugging with the latest version (from svn) of ImageMagick and it returns 16 instead of 1. It must have been fixed in the mean time. I am working on adding requid-rescale support to Magick.NET which means I will probably publish a new version of Magick.NET (with IMv6 instead of 7) that should fix this. I have also added a unit test to my local copy to make sure it stays fixed.
Oct 7, 2013 at 10:01 AM
Thank you for your quick reply.

Oct 19, 2013 at 12:27 PM
Edited Oct 20, 2013 at 8:19 PM
It turns out that this has to do with enabling HDRI. My previous test was with ImageMagick itself. In ImageMagick v6 HDRI is not enabled by default. I am now investigating this to make sure this get fixed before the next release.

Edit: It was a bug, I just committed by changes to the svn repository of ImageMagick. I will also rename the Depth method with a channel parameter to BitDepth.

p.s. Bedankt voor het vinden van deze fout :)