XYZ to sRGB corrected
Posted: 2015-01-28T11:56:22-07:00
While using imagemagick for some JPEG2000 to TIFF conversions using the commands from this page, I noticed a problem with the resulting file.
For this test, I was using a professional DCinema encoder to encode from TIFF to JPEG2000 image, and imagemagick was used to convert it back to TIFF.
Unfortunately, the conversion was not quite right, and the image was slightly brighter. After a lot of searching and reading, I found out that in the imagemagick command line, there was no function to fix the Normalization Factor for White Point in DCinema, using the Luminance level 48fL for a Peak of 52.37 cd/m2.
So, for this command line to be correct, the following change would have to be applied:
The " 1.09104167" is the constant from the calculation of 52.37/48 that should be applied to all pixel values after gamma inverse adjustment and prior to matrix color change.
For this test, I was using a professional DCinema encoder to encode from TIFF to JPEG2000 image, and imagemagick was used to convert it back to TIFF.
Unfortunately, the conversion was not quite right, and the image was slightly brighter. After a lot of searching and reading, I found out that in the imagemagick command line, there was no function to fix the Normalization Factor for White Point in DCinema, using the Luminance level 48fL for a Peak of 52.37 cd/m2.
So, for this command line to be correct, the following change would have to be applied:
Code: Select all
#!/bin/bash
xyz2srgb() {
convert -verbose "$1" \
-type TrueColor \
-alpha Off \
-gamma 0.384615 \
-evaluate multiply 1.09104167 \
-color-matrix "3.2404542 -1.5371385 -0.4985314 \
-0.9692660 1.8760108 0.0415560 \
0.0556434 -0.2040259 1.0572252" \
-gamma 2.2 \
-set colorspace sRGB \
-depth 8 \
$(basename "$1" ".j2c").tif