# CIE xyY to Radiance rgb Conversion

Dear Group

I have come across an issue regarding converting colors from CIE xyY color space to Radiance's rgb. From the post:

and from RWR, the conversion is as follows:

X=x*Y/y;
Z=(1-x-y)*Y/y;
r= 2.565*X -1.167*Y -0.398*Z;
g= -1.022*X +1.978*Y +0.044*Z;
b= 0.075*X -0.252*Y +1.177*Z;

However, when I attempt a conversion the color seems way off. For example, the color x = 0.3304 , y = 0.3582 , Y = 0.9822 which I expect to be a faint yellow converts to rgb = 0.838, 1.05, 0.825, which is more of a faint green. I have used another script found in the following paper:

The rgb.cal script in this paper list the following for xyY to rgb conversion:

X=x*Y/y;
Z=(1-x-y)*Y/y;
r= 2.739*X -1.145*Y -0.424*Z;
g= -1.119*X +2.029*Y +0.033*Z;
b= 0.138*X -0.333*Y +1.105*Z;

Although not always spot on, its much closer to the aforementioned (the previous example converts to rgb = 0.995,1.01,0.74 which is a faint yellow with a slight green tint). Thanks for any help and/or advice. As a note I should mention that I use the following online calculator to convert from 0-255 rgb color space to CIE xyY color space:

http://www.easyrgb.com/calculator.php

Regards,

Marcus

1 Like

I am not much help at the moment, as I have just swapped over my graphics
card in anticipation of a new computer, so 'faint' colours are all white
on my screen.

a try. It's been some time since I wrote it, but the range of Y that I
used (references are within the JS source code) is 0..100, which seemed to
be most commonly used, not 0..1. I realise that Y should only change the
brightness, not the hue, but anyhow--so far it has worked for me... kinda
rightish...

Having said that, don't knock the easyrgb crowd. All formulae are
published on their site. Well done.

http://www.easyrgb.com/calculator.php

Just my 2 pence.

Axel

Hi Marcus,

The formula you pulled out of the archive, which was a reply by Raphael, is correct. I don't know why you expect a color with an (x,y) of (.3304,.3582) to be more red than green, since (.3333,.3333) is neutral and you have slightly decreased red and increased green. A slight green is what I would expect to see, not a slight yellow.

I'm not sure where the slight difference between the color you obtain with the Radiance matrix and the one you obtained from the tutorial arose, but the first matrix you have below is the correct one.

There are subtle issues having to do with white point as well, which you may not be taking into account.

-Greg

···

From: "Marcus Jacobs" <[email protected]>
Date: October 18, 2005 12:04:52 PM PDT

Dear Group

I have come across an issue regarding converting colors from CIE xyY color space to Radiance's rgb. From the post:

and from RWR, the conversion is as follows:

X=x*Y/y;
Z=(1-x-y)*Y/y;
r= 2.565*X -1.167*Y -0.398*Z;
g= -1.022*X +1.978*Y +0.044*Z;
b= 0.075*X -0.252*Y +1.177*Z;

However, when I attempt a conversion the color seems way off. For example, the color x = 0.3304 , y = 0.3582 , Y = 0.9822 which I expect to be a faint yellow converts to rgb = 0.838, 1.05, 0.825, which is more of a faint green. I have used another script found in the following paper:

The rgb.cal script in this paper list the following for xyY to rgb conversion:

X=x*Y/y;
Z=(1-x-y)*Y/y;
r= 2.739*X -1.145*Y -0.424*Z;
g= -1.119*X +2.029*Y +0.033*Z;
b= 0.138*X -0.333*Y +1.105*Z;

Although not always spot on, its much closer to the aforementioned (the previous example converts to rgb = 0.995,1.01,0.74 which is a faint yellow with a slight green tint). Thanks for any help and/or advice. As a note I should mention that I use the following online calculator to convert from 0-255 rgb color space to CIE xyY color space:

http://www.easyrgb.com/calculator.php

Regards,

Marcus