mm2 / Little-CMS

A free, open source, CMM engine. It provides fast transforms between ICC profiles.
https://www.littlecms.com
MIT License
549 stars 174 forks source link

CIE XYZ D65 profile #442

Closed timeinpixels closed 5 months ago

timeinpixels commented 5 months ago

Hello,

Is it possible to create CIE XYZ D65 profile with Little CMS 2? I would like to use XYZ colorspace as an intermediate for conversions not directly supported by Little CMS or colorspaces that don't have ICC profiles.

mm2 commented 5 months ago

Yes, it is easy. Use cmsCreateXYZProfile() to create such profile. If you want to have a file on the ICC, save it using cmsSaveProfileToFile.

XYZ has no associated white point, though.

timeinpixels commented 5 months ago

When I am trying to create a transform from in-memory ICC to XYZ using cmsCreateXYZProfile() I get this error:

    if (!IsProperColorSpace(ExitColorSpace, OutputFormat)) {
        cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Wrong output color space on transform");
        return NULL;
    }
mm2 commented 5 months ago

So, use XYZ as color space. I would recommend to read the tutorial for first steps. It is in the "doc" folder.

timeinpixels commented 5 months ago

Apologies - I was creating a transform with TYPE_RGB_FLT instead of TYPE_XYZ_FLT - after this change it works OK. Thanks!

mm2 commented 5 months ago

Apologies - I was creating a transform with TYPE_RGB_FLT instead of TYPE_XYZ_FLT - after this change it works OK. Thanks!

You are welcome!