[Lcms-user] Check Out-of-gamut in Output CMYK Profile
An ICC-based CMM for color management
Brought to you by:
mm2
From: Sapaico-Valera, R. <ric...@oc...> - 2017-04-12 11:46:03
|
Hello, I have an output CMYK ICC profile, which I created using a printing RIP software. Using MATLAB, I can verify that in the ICC Profile Header: Device Class='output' ColorSpace='CMYK' ConnectionSpace='Lab RenderingIntent = 'Perceptual' Version='4.0.0' Also, when I take a look at the 'CLUT' structures in the Profile, I can see that they are in the uint16 format. Using an ICC profile viewer, I am able to find out whether a Lab value is inside or outside the gamut. However, I would like to test programmatically whether a list (~1000) of Lab values is inside or outside the gamut. >From what I found in the mailing list, I am using the following code: --------------------------------------------------- cmsHPROFILE hInProfile, hNULL; cmsHTRANSFORM xform; cmsUInt16Number Alarm[16] = { 0xFF, 0xFF, 0xFF }; cmsSetAlarmCodes(Alarm); hInProfile = cmsOpenProfileFromFile("MyICCProfile.icc", "r"); if (hInProfile == NULL) return 0; // Failed hNULL = cmsCreateNULLProfile(); xform = cmsCreateProofingTransform( hInProfile, // Input TYPE_CMYK_16, // Input Format hNULL, // Output TYPE_GRAY_8, // Output Format cmsCreate_sRGBProfile(), // Proofing INTENT_RELATIVE_COLORIMETRIC, // Intent INTENT_RELATIVE_COLORIMETRIC, // Proofing Intent cmsFLAGS_GAMUTCHECK // Flags ); cmsCIELab Lab1 = { 83.53, 5.35, 15.22 }; cmsCIELab Lab2 = { 12.75, -6.35, -2.32 }; cmsUInt8Number gamut; cmsDoTransform(xform, &Lab1, &gamut, 1); cmsDoTransform(xform, &Lab2, &gamut, 1); cmsDeleteTransform(xform); cmsCloseProfile(hInProfile); cmsCloseProfile(hNULL); --------------------------------------------------- Using the Profile Gamut viewer, I know that the value 'Lab1' is inside, and 'Lab2' is outside. However, when I ran the code above, I get both of them as inside. Next, I thought maybe if I changed the input to cmsDoTransform to be the corresponding CMYK values it might work: --------------------------------------------------- cmsUInt16Number CMYK1[4], CMYK2[4]; CMYK1[0] = 6553; CMYK1[1] = 13107; CMYK1[2] = 19660; CMYK1[3] = 0; // C=10%, M=20%, Y=30%, K=0% -> should be in-gamut CMYK2[0] = 52428; CMYK2[1] = 42597; CMYK2[2] = 42597; CMYK2[3] = 39321; // C=80%, M=65%, Y=65%, K=60% -> should be out-of-gamut --------------------------------------------------- But it didn't help, and I still get "gamut=0" for both CMYK values (I even tried with extreme values as C=M=Y=K=0% and C=M=Y=K=100%, to no avail). I did some debugging and I found something it might help. In 'cmslut.c', in the "_LUTeval16" function (lines 1294..1314), the variable "lut->InputChannels" is 3; however, I was expecting it to be 4, since I'm working with CMYK values. Moreover, the correct 16-bit CMYK values are stored in the variable In[]. Could you please let me know what I am doing wrong? I have the suspicion that my input to the 'cmsDoTransform' might not be ok; but I cannot figure it out what else I could try. Thank you very much in advance for your help. Best regards, Ricardo Sapaico This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation. |