From: <Mar...@li...> - 2014-07-28 11:41:59
|
Hi, Littlecms allows to use arbitrary stages in pipelines, but the ICC spec restricts AToB tags to only certain pipelines and certain stages. In particular, floating point tabulated curves are not supported as part of AtoB tags. You need to read the ICC spec and use only the supported stages if you want to create ICC profiles. regards Marti Quoting Gert Van Hoey <ger...@gm...>: > Hello, > > I’m having a problem adding a curveType to an AToB tag. > > The code below (based on an earlier post in this mailing list) > produces a profile with AToB tag containing parametric curves, as > expected. But when I try to add a curve specified as a list of > values (by uncommenting the commented line, and commenting the one > just before), then no profile is produced (cmsSaveProfileToFile > returns false). > > Any suggestion about what’s going wrong ? > > Best regards, > > Gert > > cmsContext context = cmsCreateContext(0, 0); > cmsHPROFILE profile = cmsCreateProfilePlaceholder(context); > cmsSetProfileVersion(profile, 4.3); > cmsSetDeviceClass(profile, cmsSigDisplayClass); > cmsSetColorSpace(profile, cmsSigRgbData); > cmsSetPCS(profile, cmsSigXYZData); > > cmsPipeline* pipeline = cmsPipelineAlloc(context, 3, 3); > cmsFloat64Number data[] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; > cmsFloat64Number offset[] = {0.0, 0.0, 0.0}; > cmsToneCurve* gamma[3]; > gamma[0] = gamma[1] = gamma[2] = cmsBuildGamma(context, 1.0); > > cmsToneCurve *curves[3]; > cmsFloat32Number rr[256]; > cmsFloat32Number gg[256]; > cmsFloat32Number bb[256]; > for (int i = 0; i < 256; ++i) > { > rr[i] = gg[i] = bb[i] = cmsFloat32Number(i) / 255; > } > curves[0] = cmsBuildTabulatedToneCurveFloat(context, 256, rr); > curves[1] = cmsBuildTabulatedToneCurveFloat(context, 256, gg); > curves[2] = cmsBuildTabulatedToneCurveFloat(context, 256, bb); > > cmsPipelineInsertStage(pipeline, cmsAT_BEGIN, > cmsStageAllocToneCurves(context, 3, gamma)); > //cmsPipelineInsertStage(pipeline, cmsAT_BEGIN, > cmsStageAllocToneCurves(context, 3, curves)); > > cmsPipelineInsertStage(pipeline, cmsAT_END, > cmsStageAllocMatrix(context, 3, 3, data, offset)); > cmsPipelineInsertStage(pipeline, cmsAT_END, > cmsStageAllocToneCurves(context, 3, gamma)); > cmsFreeToneCurve(gamma[0]); > cmsWriteTag(profile, cmsSigAToB0Tag, pipeline); > cmsPipelineFree(pipeline); > cmsSaveProfileToFile(profile, "test.icc"); > cmsCloseProfile(profile); |