I've been working on a piece of code that does precisely this. I input a color value, either RGB or CMYK, then utilize an ICC profile—specifically AdobeRGB1998.icc for RGB and CoatedFOGRA39.icc for CMYK—coupled with a rendering intent set to RelativeColorimetric. The result? A converted XYZ value representing that color in a device-independent color space. However, I hit a stumbling block when I tried to reverse this operation. Using the same approach, I aimed to input an XYZ value and, through the...