JAVA CIEXYZ ColorSpace Conversion

102 Views Asked by At

Hello i am trying to write my own HSL Colorspace in Java but i ran into an problem with the CIEXYZ conversion...

I have already writen a from/toRGB Method but java requires to write a from/toCIEXYZ method too. I thought i could use the pre-implemented CIEXYZ Colorspace for that...

@Override
public float[] fromCIEXYZ(float[] colorvalue) {
    return fromRGB(CIEXYZ.toRGB(colorvalue));
}

but this doesn't work and after some time i figured out that the CIEXYZ colorspace java provides doesnt works like i expected it...

ColorSpace cieXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);
    System.out.println(Arrays.toString(cieXYZ.toRGB(cieXYZ.fromRGB(new float[]{1,0.5f,0}))));

the result of this small code is [0.9820706, 0.49709317, 0.122087434] and not [1 , 0.5, 0]...

can anybody explain me why? and how can i fix this?

0

There are 0 best solutions below