Hi,

> I would like to know if there is a way to create a simple abstract 
> profile using only a 3x3 matrix, for example a XYZ<->XYZ profile with 
> a Bradford matrix transform without creating heavy 3D Luts or other 
> big structures. A profile similar to a monitor one but with PCS<->PCS 
> transform would be great, but I don't know if it's possible or even 
> accepted by the ICC standard...

It is certainly possible. You need, however, a V4 profile. AToB0 tag
needs  tone curves + matrix/offset + tone curves The code in lcms 2
would be something like the code I'm attaching below.

Hope this helps
Marti

---

#include "lcms2.h"


int main(void)
{
    cmsHPROFILE hProfile;
    cmsPipeline* Pipeline = cmsPipelineAlloc(0, 3, 3);

    cmsFloat64Number Data[] = {  1, 0, 0,
                                 0, 1, 0,
                                 0, 0, 1};
    cmsFloat64Number Offset[] = { 0, 0, 0 };
    cmsToneCurve* Linear3[3];

    hProfile = cmsCreateProfilePlaceholder(0);

    cmsSetProfileVersion(hProfile, 4.2);
    cmsSetDeviceClass(hProfile, cmsSigAbstractClass);
    cmsSetColorSpace(hProfile, cmsSigXYZData);
    cmsSetPCS(hProfile, cmsSigXYZData);

    Linear3[0] = Linear3[1] = Linear3[2] = cmsBuildGamma(0, 1.0);

    cmsPipelineInsertStage(Pipeline, cmsAT_BEGIN, 
cmsStageAllocToneCurves(0, 3, Linear3));
    cmsPipelineInsertStage(Pipeline, cmsAT_END, cmsStageAllocMatrix(0, 
3, 3, Data, Offset));
    cmsPipelineInsertStage(Pipeline, cmsAT_END, 
cmsStageAllocToneCurves(0, 3, Linear3));

    cmsFreeToneCurve(Linear3[0]);

    cmsWriteTag(hProfile, cmsSigAToB0Tag, Pipeline);
    cmsPipelineFree(Pipeline);

    cmsSaveProfileToFile(hProfile, "abstract_xyz.icc");
    cmsCloseProfile(hProfile);

    return 0;
}



------------------------------------------------------------------------------

_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to