1
votes

I want to convert 16 bit (HALF) exr image into 32 bit exr image. I am trying to do it using ImageMagick built with openEXR, But I am not able to do the the same.

I have Build ImageMagick-7.0.8-23-Q8-windows-x64-static with HDRI flag enabled. I am using 16 bit RGBA EXR file . When I run below command:

identify -verbose "Desk.exr"

It gives Channel depth as 8 bit.

Format: EXR (High Dynamic-range (HDR))
Class: DirectClass
Geometry: 644x874+0+0
Units: Undefined
Colorspace: RGB
Type: TrueColorAlpha
Base type: Undefined
Endianess: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit

I tried to change it by using convert tool by specifying -depth 16 and 32, but it is still showing channel depth as 8 bit.

int main() {

Magick::InitializeMagick("");

Magick::Image image;
Magick::Image image2;
Magick::Image image3;
try {
     // Read a file into image object 
    image.read("D:\\IR\\EXR_Support\\Images\\Desk.exr");
            //Set bit to 32
    image.depth(32);
            image.channelDepth(MagickCore::RGBChannels,32);
            image.write("D:\\IR\\EXR_Support\\Images\\Desk_32Bits.exr");

    }
catch (Magick::Exception &error_)
{
    cout << "Caught exception: " << error_.what() << endl;
    return 1;
}
    return 0;

}

I checked channel depth of output file , that I have set 32 bit, but it is also showing :
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit

I have built imagemagick with Quantum 8 bit and I am expecting it should work for 16 and 32 bit.

1
EXR store color data as float point values. Decoding them with a Q8 library version will introduce significant loss of precision.emcconville

1 Answers

1
votes

The quantum depth, a.k.a. Q setting, is specified at compile time. You can't increase it at run-time.

If you want to process 32-bit images, you will need to re-compile with 32-bit quantum depth.