Eric, sorry for the confusion, I think I wrote it too quick:
Guillaume's library uses sRGB with D65 white ref. If you want to continue using that conversion, then just copy/paste
XYZtoRGB into your code.
- you get a correct code
- the calculation is more precise with the expanded constants.
If you would like a conversion which is very similar to Adobe's, then you need to do the other proposed changes as well: RGB Bradford at D50.
Here is the ready copy/paste
XYZtoRGB for RGB Bradford:
public static RGB XYZtoRGB(double x, double y, double z)
double Clinear = new double;
Clinear = x*3.1338561 - y*1.6168667 - z*0.4906146; Clinear = -x*0.9787684 + y*1.9161415 + z*0.0334540; Clinear = x*0.0719453 - y*0.2289914 + z*1.4052427;
for(int i=0; i<3; i++)
Clinear[i] = (Clinear[i]<=0.0031308)? 12.92*Clinear[i] :
(1+0.055)* Math.Pow(Clinear[i], (1.0/2.4)) - 0.055;
Clinear[i] *= 255.0;
return new RGB((int)Clinear, (int)Clinear, (int)Clinear);
If you need help for the rest, just shout.
BTW, you can make a chicken fly, it all depends on the height of the building...