2
$\begingroup$

When converting from sRGB to CIEXYZ I seem to be off by a factor of 100

I'm trying to convert from sRGB to CIELAB.

Calculation

  • First I need to go from sRGB to CIEXYZ. Using this formula I get i.e. for sRGB(197, 199, 196) -> "linear"RGB(0.558, 0.571, 0.552) -> XYZ(0.534, 0.567, 0.604).

    When comparing this some online converter the values seem to be off by a factor of 100.

  • Next I use this formula to go to CIELAB (with the D65 illuminant (Xn: 95.0489, Yn: 100, Zn: 108.884)). With the example above I get L*ab(5.122, -0.197, 0.198) which to me seems completly off.

    Comparing to an online converter seems to further confirm my suspicion, since the difference in values it gives me can not be attributed to rounding errors or the use of slightly different constants.

Question:

  • Did I do something wrong in my calculations?
  • Is the CIEXYZ space supposed to go from 0 to 1 or from 0 to 100?
  • Am I misreading something in the Wikipedia articles or is the first one using 0 to 1 and the second one 0 to 100? If yes, why?
$\endgroup$
1
  • $\begingroup$ brucelindbloom.com is a reliable source that provides conversion information (click on the "math" link) and has a calculator that implements the conversions outlined in the table. $\endgroup$
    – pmw1234
    Commented Nov 6, 2023 at 0:04

1 Answer 1

0
$\begingroup$

To quote from the Wikipedia page for the CIE 1931 color space "The unit of the tristimulus values X, Y, and Z is often arbitrarily chosen so that Y = 1 or Y = 100 is the brightest white that a color display supports."

Sometimes the values are in the range 0 to 1, and sometimes in the range 0 to 100. You just need to specify the illuminant using the same range as other XYZ values you are using. As the linear RGB values and resulting XYZ values are in the range 0 to 1, if you give the D65 values as X=0.950489, Y=1, Z = 1.08884 I think you'll get the results you want.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.