<p>To quote from the Wikipedia page for the CIE 1931 color space &quot;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.&quot;</p>
<p>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.</p>

CC BY-SA 4.0
2023-11-05T16:57:01.613Z
2023-11-05T16:57:01.613Z
Timothy Maguire
<h2>When converting from sRGB to CIEXYZ I seem to be off by a factor of 100</h2>
<p>I'm trying to convert from sRGB to CIELAB.</p>
<h3>Calculation</h3>
<ul>
<li><p>First I need to go from sRGB to CIEXYZ. Using <a href="https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ" rel="nofollow noreferrer">this formula</a> I get i.e. for <code>sRGB(197, 199, 196) -&gt; &quot;linear&quot;RGB(0.558, 0.571, 0.552) -&gt; XYZ(0.534, 0.567, 0.604)</code>.</p>
<p>When comparing this some <a href="https://colormine.org/convert/rgb-to-xyz" rel="nofollow noreferrer">online converter</a> the values seem to be off by a factor of 100.</p>
</li>
<li><p>Next I use <a href="https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB" rel="nofollow noreferrer">this formula</a> to go to CIELAB (with the D65 illuminant (<code>Xn: 95.0489, Yn: 100, Zn: 108.884</code>)). With the example above I get <code>L*ab(5.122, -0.197, 0.198)</code> which to me seems completly off.</p>
<p>Comparing to an <a href="https://colormine.org/convert/rgb-to-lab" rel="nofollow noreferrer">online converter</a> 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.</p>
</li>
</ul>
<h3>Question:</h3>
<ul>
<li>Did I do something wrong in my calculations?</li>
<li>Is the CIEXYZ space supposed to go from 0 to 1 or from 0 to 100?</li>
<li>Am I misreading something in the Wikipedia articles or is <a href="https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ" rel="nofollow noreferrer">the first one</a> using 0 to 1 and <a href="https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB" rel="nofollow noreferrer">the second one</a> 0 to 100? If yes, why?</li>
</ul>

CC BY-SA 4.0
2023-11-06T00:04:26.773Z
http://www.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.
pmw1234
<mathematics><color><colorspace><conversion>
value range in CIEXYZ space
md7
# value range in CIEXYZ space

(Asked by: username_0 on 2023-10-23)

## 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](https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ) 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](https://colormine.org/convert/rgb-to-xyz) the values seem to be off by a factor of 100.
* Next I use [this formula](https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB) 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](https://colormine.org/convert/rgb-to-lab) 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](https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ) using 0 to 1 and [the second one](https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB) 0 to 100? If yes, why?

**Tags:** mathematics, color, colorspace, conversion

> **Comments:**
> **username_1**: http://www.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.  

---

## 1 answers

### Answer by username_2 on 2023-11-05. Score: 0 | Accepted answer

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.


---

