New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Oklab/Oklch? #380
Comments
Here is the definition of Oklab: https://bottosson.github.io/posts/oklab/ |
That seems a nice addition, and would be as easy as adding a color space profile bult-in. |
That’s great to hear! Currently, I’m doing this conversion in my own code. Probably this is not directly useful for you, because it’s hard-code and depends on C++ and Qt. But those are the steps: Conversion from an arbitrary ICC profile to OklchArbitrary ICC profile → XYZ-D50This is done with LittleCMS as usual. Let’s call the result V₁. XYZ-D50 → XYZ-D65Let’s call the result V₂. The chromatic adaption is done with the Bradford transformation, as proposed here. Formula: V₂ = M⁻¹ × V₁. XYZ-D65 → OklabThe transformation is done as described here in the Oklab definition. Oklab → OklchThis can be done via Conversion from Oklch to an arbitrary ICC profileOklch → OklabThis can be done via Oklab → XYZ-D65The transformation is done as described here in the Oklab definition. Let’s call the result V₂. XYZ-D65 → XYZ-D50Let’s call the result V₁. The chromatic adaption is done with the Bradford transformation, as proposed here. Formula: V₁ = M × V₂. XYZ-D50 → Arbitrary ICC profileThis is done with LittleCMS as usual. |
@sommerluk It is a colorspace profile, so It can deal with OkLab-> whatever and whatever->OkLab. Note that it uses D50 as PCS white point. The stages are:
I still have to figure out how to deal with white point in unadapted absolute colorimetric, probably a D65 should be used as media white. It should do its way to 2.16, which is still months ahead. Thanks again for the idea. |
That's great! I've downloaded it and played around, and it works fine. Maybe it makes sense to add #define TYPE_OKLAB_DBL (FLOAT_SH(1)|COLORSPACE_SH(PT_MCH3)|CHANNELS_SH(3)|BYTES_SH(0)) to the public header? Thanks for implementing this as fast! That's a super-conveniant feature! |
Full support is now added by 6cabbce |
That's great. Thanks a lot! |
Hi, @mm2, I have created an ICC profile for oklab in this situation, but I found that when |
You are including only BtoD /DToB tags which according the spec are to be used as a complement specialized on floats. You should use AtoB/BToA tags and if you want more precision on floats then also add DToB/BToD . If you could use unstable, 2.16 has an OkLab implementation on cmsCreate_OkLabProfile(). You can look at the code too. |
Okay, thank you so much!
|
Well, I tried to create the oklab icc profile in krita using |
This particular profile cannot be saved. The ICC file format does not support the combination of stages in the pipeline. It only works as a built-in. |
Okay, I got it. Thank you. |
Hi, @mm2, I created the oklab profile using
|
Thanks for reporting. This seems not related to OkLab but on transforms going float->integer. If you use floats on rgb the roundtrip works well, so it is not the profile. I will file a bug regarding this issue, not limited to OkLab. See below the code that works fine `
` |
Okay, that's great. Thanks! |
It is now fixed by 4c0c66e, but I have to check it more carefully. |
Now it works fine in krita! Really thank you for your help! |
Oklab is an alternative to Cielab. It works with the same logic, but claims to be more perceptually uniform than Cielab. It uses a D65 whitepoint. There are conversions defined from and to XYZ-D65 (a matrix + a cubic root respective power of three + another matrix).
Since its inclusion in the CSS Color Module Level 4 [W3C Candidate Recommendation Draft] it’s gaining wider support.
Would it be possible to support Oklab (and its derived cylindrical variant, Oklch) in LittleCMS out-of-the-box? So that pipelines can directly convert between Oklab/Oklch and an arbitrary ICC profile?
The text was updated successfully, but these errors were encountered: