Thank you for the reply. I figured out on Friday, that I used the Null and custom profiles in wrong order (found an old example for lcms 1 and adapted it). But almost all Lab values were giving me out of gamut warning. So I implemented my own warning, that I make Lab -> ICC -> RGB transform and the reverse one. Then I compute deltaE of the original Lab and the one after conversion to RGB and back. I set a threshold of deltaE 5 (found this in lcms constants and sounds reasonable) and this gives me much better results. Is this a good way or should I trust the proofing transform more? Thank you. Regards,
Martin On 24. 11. 2013 11:04, marti.ma...@littlecms.com wrote: > > > Hello Martin, > > You almost got it. It doesn't work because the order is wrong. > > Ok, lets revise what you want to do. You said, you want to check if a > Lab color is withing an ICC profile gamut. That's fine, and this > functionality can be obtained by cmsCreateProofingTransform. Ok so far. > > Then the question is how you want to mark this. One possible solution > would be to use an array of byes. If the color is withing, then the > byte would be set to '00'. If out of gamut 'FF'. > > To do that, we could use the NULL profile. This is an special 1-channel > profile that always returns 0. Being 1-channel, this can be interpreted > as gray. > > The trick comes now with the alarm color. NULL profile will return always > 0, but the alarm color will bypass the transform and therefore give > whatever value you set. 'FF' for example. > > So that's how the transform works. There are some leaks here since the > profiles are created and never set free, but you can take the idea. > > There is no softproofing here, only gamut check. And then you could > do the check by calling cmsDoTransforms in this way; > > cmsHTRANSFORM xfrm = > cmsCreateProofingTransform(cmsCreateLab4Profile(NULL), TYPE_Lab_DBL, > cmsCreateNULLProfile(), TYPE_GRAY_8, cmsCreate_sRGBProfile(), > INTENT_RELATIVE_COLORIMETRIC, INTENT_ABSOLUTE_COLORIMETRIC, > cmsFLAGS_GAMUTCHECK); > > cmsCIELab Lab = { 50, -125, 125 }; > cmsCIELab Lab2 = { 50, -10, 12 }; > > cmsUInt8Number gamut; > cmsDoTransform(xfrm, &Lab, &gamut, 1); // Gives the alarm != 0 > cmsDoTransform(xfrm, &Lab2, &gamut, 1); // Gives 0 > > That should work as you expect. > > Regards > Matri > > Quoting Martin Florek <mflo...@gmail.com>: > >> I would like to check if a Lab color is within an ICC profile's gamut. >> For this I create a proofing transform, but I get an error "Couldn't >> link the profiles". I create the transform like this: >> >> cmsCreateProofingTransform(cmsCreateLab4Profile(), TYPE_Lab_DBL, >> outProfile, TYPE_RGB_DBL, cmsCreateNULLProfile(), >> INTENT_RELATIVE_COLORIMETRIC, INTENT_ABSOLUTE_COLORIMETRIC, >> cmsFLAGS_GAMUTCHECK | cmsFLAG_SOFTPROOFING); >> >> When I create a normal transform from the custom Lab and the outProfile >> (loaded from an ICC profile file), the conversion works perfectly. I set >> the alarm codes to 0xffff before creating a proofing transform. >> >> What am I doing wrong? Another question about out of gamut values, is >> there a way to get unbounded results from a transform (or multi profile >> transform) so I could check if the colour is out of gamut when RGB >> values are smaller than zero and bigger than 1, without the need of a >> proofing profile? Thank you. >> Regards, >> >> >> Martin >> >> ------------------------------------------------------------------------------ >> >> Shape the Mobile Experience: Free Subscription >> Software experts and developers: Be at the forefront of tech innovation. >> Intel(R) Software Adrenaline delivers strategic insight and game-changing >> conversations that shape the rapidly evolving mobile landscape. Sign >> up now. >> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk >> >> _______________________________________________ >> Lcms-user mailing list >> Lcms-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/lcms-user > > ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user