Registered Member
|
I recently learned about a colorspace called Oklab : https://bottosson.github.io/posts/oklab/
This colorspace is somewhat like Lab in the sense that its an opponent colorspace (red<->green, blue<->yellow). It claims to have better perceptual blending between the colors. I did try it in my own programs and it seems to live upto the claims as per my own observations. You can find several samples by the author of that colorspace in the link above. So I wanted to see if I can try it in Krita. I read about LCMS library, and was able to create a color profile using its API. In the color profiles, there are several tags which contain various information. Some of the tags of the form AToB* and BToA* store what LCMS calls "pipelines", which are essentially converters of color from once space to another. So my question is, if I want to make one such profile to use in Krita, what conversions should I need to provide in the profile. Unless I am missing something, I can guess I will need to provide one AToB and one BToA atleast. But the problem is, based on looking at Krita's code, I was unable to figure out which target profile do I need to provide conversions for. Do I need to provide conversion from OkLab <-> Linear RGB ? or sRGB ? or XYZ ? And also, do I need to provide some other tag within the profile to let Krita know that its a LAB like space ? |
KDE Developer
|
All colorspaces of the type of Lab, JAzBz, ICtCp and also OKLab work by defining a transform from XYZ to LMS and then their own transform (and the reverse). Very often you'll also find a sRGB to XYZ transform added, because programmers showing the code assume you are trying to blindly test this algorithm in javascript and only have sRGB available. That part won't be necessary, LCMS can handle the conversion from any RGB profile to XYZ for you. What you'll need to provide is the conversion from XYZ to the perceptual space in question, and the reverse.
I was under the impression these could only be done as LUTs however. As for the setting it as a 'lablike', we use the colorspace signature which should always be present in ICC profiles. For the record, I was under the impression that lablikes which aren't actually lab should be marked as YCbCr, but we have an assert there because of a very dumb bug where we associate the wrong signature in the code here, which is trivial to fix, but I haven't done so yet, because I discovered it when I was doing something completely different and needed to focus on that. This is all I know, you'll have to contact Marti (LCMS maintainer) or other ICC experts if you want to know more. Good luck! As an aside, krita-artists.org is the more active forum, this one is more legacy... |
Registered Member
|
I was actually talking entirely from the LCMS' C API available here : https://www.littlecms.com/LittleCMS2.12%20API.pdf As per what the API says and I was able to test, any ICC profile I create using that API, can provide color conversion from any space to any, and more than one, in a single profile. in LCMS, there are these structures what it calls pipelines. Each pipeline consists of many stages, each stage being a matrix multiplication, or a power function or a table lookup. I can put in any numbers in those matrices or stages. After creating those pipelines, then I can tell the LCMS to create an empty profile structure, and put that pipeline into it. Anything I put into the profile, like the pipeline above, will need to be put under a proper tag, because a profile is basically a key-value container, a key being a tag (from set of fixed tags). So my question was basically, what Krita will actually do if I provide it with a new profile. The tag names dont contain names of color spaces. They are named like "A2B0", "B2A0", "A2B1", etc. So lets say I create a pipeline and put into A2B0. What will krita assume A and B are ? If A is the colorspace I am providing (Oklab in this case), then I still need to know B, to know what numbers I use in those matrices when creating the pipeline stages.
Yes, I saw the code and there was a lot of it which was trying to figure out what the color profile is providing. But there were several classes involved talking to one another that I was unable to figure out concretely what I have to provide. But in any case, whatever I have to provide, I can only provide via tags, because atleast as per LCMS API, thats the only way I can store anything in the ICC profile I create. And for that I need to know which tags and what values for those tags its expecting.
Oh. Ok so from next time onwards I will use that forum, but what about this very problem, do you suggest I post there too ? Or should I just wait here only ? |
KDE Developer
|
As noted here in section 9 (though 6 is also important): 'B' is the PCS, that is the profile connection space, which in your case is XYZ (for many cmyk profiles it's usually LAB), and 'A' always the source space(in your case OKLab). I'd recommend looking at the spec for more on these tags, as they are related to rendering intent as well.
I'd mostly recommend Krita artists if you want people to help test. |
Registered Member
|
Thanks, I'll read the spec and see if I can fix it. There are some other requirements on tags written there. I'll make a thread on that forum after trying to make it work with the particular spec you linked. Thanks again. |
Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]