I think the ACES color profile in libraw is incorrect

This is in reference to using dcraw_emu, though I imagine this could be an issue for libraw in general. I was comparing the output of photos developed with ACES to output with ProPhoto in a color managed photo viewer, and I noticed the colors just seemed a bit off, they looked warmer than I would expect. So, I extracted the ICC profile from the photo and took a look at the primaries, shown in the forward matrix below.

X 1.00600 0.01668 -0.05212
Y 0.36885 0.72124 -0.08864
Z -0.00362 0.01096 0.75758

The rows should sum to a D50 white point. However, they instead sum to 0.97056 1.00145 0.76492. This is approximately a 4700K white point, which is significantly out of line with the ICC specifications.

Further inspecting the profile using argyllCMS's xicclu function revealed further issues. When using the command xicclu -ir -pl -s255 aces.icc and entering 255 255 255 , I should have L*a*b* values of 100,0,0 returned. While it is common for the L*a*b* values for white to be slightly off due to hexadecimal arounding error, the issue here is much more serious. The value I get is 100.05, 0.853, 5.06, which corresponds to an RGB value of 255, 254, 245 which is a pale yellow color. That explains why images developed with dcraw_emu's ACES profile are significantly warmer than they ought to be.

I would propose changing the forward matrix for ACES to

X 0.990854688 0.012242375 -0.03889418
Y 0.361883143 0.722508700 -0.08439184
Z -0.002709415 0.008248784 0.81936603

for consistency with the ICC PCS illuminant (xyz=0.964203, 1, 0.82491). though it's common to see icc profiles use the ASTM values for D50 , that being xyz=0.96422,1,0.82521).

Note that even if the white point is D65 or D60, the rows of the forward matrix should sum to the D50 values. Or is there a reason the ACES profile has an apparently incorrect white point? Anyone have any insight on that?


> Note that even if the white

> Note that even if the white point is D65 or D60, the rows of the forward matrix should sum to the D50 values.

Not in Coffin's workflow, he uses D65 to avoid an extra step of chromatic adaptation (check his ProPhoto RGB, for example).

Also, aces_rgb[3][3] is not a forward matrix, it's sRGB to ACES matrix (see identity matrix rgb_rgb[3][3] for sRGB).

We will check the aces_rgb matrix to make sure it follows the same logic as other matrices.

Iliah Borg


I checked the ProPhoto and sRGB XYZ values, and when arranged in a matrix the rows sum to the expected D50 values. The ACES one was the only one that was abberant.

The D65 part comes in the MediaWhitePoint tag in the ICC profiles. There's no issue with that, I'm aware of that aspect of Coffin's color profiles and they have correct values in the MediaWhitePoint tag.

The XYZ values in the ICC profile which form the RGB to XYZ matrix ('forward matrix') though should sum to the connection space illuminant however, which is D50 regardless of the media white point. This is because these values take it from the connection space, which is CIE D50 2 degree observer XYZ space, to RGB, and chromatic adaptation to the media white point is done from there. See section of https://www.color.org/specification/ICC1v43_2010-12.pdf

In any case, the sums of the XYZ values found in the ACES profile I extracted are 0.97056 1.00145 0.76492 respectively. Looks like it's almost the correct set of values, but somewhere along the way there was probably a typo. I'm not sure if this is exclusive to libraw or if this was also present in the original dcraw since I don't have the original dcraw currently.

Thanks for getting back to me!

I'm saying that matrices in

I'm saying that matrices in Coffin's workflow are of a different nature (his workflow doesn't use "forward matrix for ACES", or "ACES colour profile", so no place to change it), and that we will check aces_rgb matrix to see if the chromatic adaptation from ACES "D60-like" white point to D65 necessary for Coffin's workflow is missing.

Iliah Borg


To which matrices are you referring? The cam2rgb matrices? I am talking about what's in the actual icc profiles embedded in the images, to be clear.

I think I made it clear what

I think I made it clear what I'm referring to, and so did you. We can't fix what is not there. Your proposal is technically impossible (and in any case, the starting point is the matrix in the standard), and I explained what we are going to do. Let's return to the topic only when there will be anything new to discuss.

Iliah Borg

My apologies if I offended or

My apologies if I offended or annoyed you. I was under the mistaken impression that the ICC profiles are simply assigned on output

> My apologies if I offended

> My apologies if I offended or annoyed you.
Not in the least.

> I was under the mistaken impression that the ICC profiles are simply assigned on output
They are not, but even if they were, what good is it to assign one profile while converting to a different one?

I checked, and yes, Coffin's aces_rgb matrix isn't adapted to D65.

Fixed in master now (the changes are in src/tables/colorconst.cpp) https://github.com/LibRaw/LibRaw/commit/1974214acf47ef260853d74006765746...

Iliah Borg

Btw, I'm wondering how useful

Btw, I'm wondering how useful (or harmful?) is it to have that huge ACES AP0 output color space when LibRaw is limited to uint16 representation...

Sounds like an AP1-based ACEScg D65 adapted option would be good to have as well?

One should perhaps clarify in the docs that AP0 based "ACES2065-1 adapted to D65" is meant by the existing "ACES" enum?

LibRaw is limited to whatever

LibRaw is limited to whatever raw data is. Processing of raw data (white balance, colour space conversion, gamma) is out of the scope of main LibRaw functionality, we keep such processing for testing purposes only. LibRaw is not a raw converter and isn't meant to be one ;)

Iliah Borg

I realize that, just thinking

I realize that, just thinking out loud pragmatically 😉

I guess there are ProPhoto and Rec2020 outputs available to cover a "similar" range and precision...

xtreme color!

There's other huge gamuts too, like xTremeRGB , MaxRGB, and AllColorsRGB. None of these are in libraw, but the description of xtremeRGB says that, "CAUTION: XtremeRGB may cause hallucinations or eye cancer." (http://www.hutchcolor.com/profiles.html)