From 676e803e4c34aa223da0b811c8a3ef11ed801afb Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Sun, 10 Nov 2024 19:58:35 +0100 Subject: [PATCH] Fix a bug on CMYK gamut check when using float Lab as input space. For what it seems, it has been there for many years. --- src/cmsgmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cmsgmt.c b/src/cmsgmt.c index 7067cf11..3064c166 100644 --- a/src/cmsgmt.c +++ b/src/cmsgmt.c @@ -298,8 +298,9 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID, cmsUInt32Number dwFormat; GAMUTCHAIN Chain; cmsUInt32Number nGridpoints; - cmsInt32Number nChannels; + cmsInt32Number nChannels, nInputChannels; cmsColorSpaceSignature ColorSpace; + cmsColorSpaceSignature InputColorSpace; cmsUInt32Number i; cmsHPROFILE ProfileList[256]; cmsBool BPCList[256]; @@ -345,11 +346,13 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID, AdaptationList[nGamutPCSposition] = 1.0; IntentList[nGamutPCSposition] = INTENT_RELATIVE_COLORIMETRIC; - ColorSpace = cmsGetColorSpace(hGamut); nChannels = cmsChannelsOfColorSpace(ColorSpace); nGridpoints = _cmsReasonableGridpointsByColorspace(ColorSpace, cmsFLAGS_HIGHRESPRECALC); - dwFormat = (CHANNELS_SH(nChannels)|BYTES_SH(2)); + + InputColorSpace = cmsGetColorSpace(ProfileList[0]); + nInputChannels = cmsChannelsOfColorSpace(InputColorSpace); + dwFormat = (CHANNELS_SH(nInputChannels)|BYTES_SH(2)); // 16 bits to Lab double Chain.hInput = cmsCreateExtendedTransform(ContextID,