using Leadtools;using Leadtools.ColorConversion;using Leadtools.Codecs;public string outputIccProfile = Path.Combine(LEAD_VARS.ImagesDir, "ColorConversion", "GetIccProfileTag", "IccLookupTableAToBTagType.icc");public void IccLookupTableAToBTagTypeExample(){// Load an ICC profilestring fileName = Path.Combine(LEAD_VARS.ImagesDir, "ColorConversion", "InputProfile.icc");IccProfileExtended iccProfile = new IccProfileExtended(fileName);// B Curves should be of the same number as Output Channels// They can be either IccTagCurveType or IccTagResponseCurveType// Fill the tagIccCurveTagType[] iccCurveTypeB = new IccCurveTagType[1];ushort[] bCurveData = new ushort[1];bCurveData[0] = IccTools.FromDoubleToU8Fixed8Number(1.5);IccCurve iccBCurve = new IccCurve(bCurveData);iccCurveTypeB[0] = new IccCurveTagType(iccBCurve);// define the ICC Matrixint[] element = new int[12] {IccTools.FromDoubleTo2bFixed2bNumber(1.0),IccTools.FromDoubleTo2bFixed2bNumber(2.0),IccTools.FromDoubleTo2bFixed2bNumber(3.0),IccTools.FromDoubleTo2bFixed2bNumber(4.0),IccTools.FromDoubleTo2bFixed2bNumber(5.0),IccTools.FromDoubleTo2bFixed2bNumber(6.0),IccTools.FromDoubleTo2bFixed2bNumber(7.0),IccTools.FromDoubleTo2bFixed2bNumber(8.0),IccTools.FromDoubleTo2bFixed2bNumber(9.0),IccTools.FromDoubleTo2bFixed2bNumber(10.0),IccTools.FromDoubleTo2bFixed2bNumber(11.0),IccTools.FromDoubleTo2bFixed2bNumber(12.0)};IccMatrix iccMatrix = new IccMatrix(element);// M Curves should be of the same number as Output Channels// They can be either IccCurve or IccResponseCurve// Fill the tagIccParametricCurveTagType[] iccParametricCurveTypeM = new IccParametricCurveTagType[1];int[] parameters = new int[1];parameters[0] = IccTools.FromDoubleTo2bFixed2bNumber(5.0);IccParametricCurve parametricCurve = new IccParametricCurve(IccFunctionsType.Function4Bytes, parameters);iccParametricCurveTypeM[0] = new IccParametricCurveTagType(parametricCurve);// Define the CLUTIccColorLookupTable8Bit iccCLUT8 = new IccColorLookupTable8Bit();// Only the first i entries are used, where i is the number of input channelsiccCLUT8.NumberOfGridPoints[0] = 1;iccCLUT8.NumberOfGridPoints[1] = 2;iccCLUT8.NumberOfGridPoints[2] = 3;// Set the percision that determines if IccColorLookupTable is used// 1 for 8-bit, and 2 for 16-biticcCLUT8.Precision = 1;// Padding bytesiccCLUT8.Pad[0] = 0;iccCLUT8.Pad[1] = 0;iccCLUT8.Pad[2] = 0;// Set the CLUT data points (arranged as described in the text in ICC.1:2004-10 specification, page 48)// The size of the data array is: multiplication of all the cells in the numberOfGridPoints array// 1 * 2 * 3 * 1 (number of output channel) * 1 (Percision) = 6iccCLUT8.Data = new Byte[6];iccCLUT8.Data[0] = 3;iccCLUT8.Data[1] = 4;iccCLUT8.Data[2] = 5;iccCLUT8.Data[3] = 6;iccCLUT8.Data[4] = 7;iccCLUT8.Data[5] = 8;// A Curves should be of the same number as Input Channels// They can be either IccCurve or IccResponseCurveushort[] aCurveData = new ushort[1];aCurveData[0] = IccTools.FromDoubleToU8Fixed8Number(1.0);IccCurve iccACurve = new IccCurve(aCurveData);IccCurveTagType iccACurveTagType = new IccCurveTagType(iccACurve);// Fill the tagsIccCurveTagType[] iccCurveTypeA = new IccCurveTagType[3];iccCurveTypeA[0] = iccACurveTagType;iccCurveTypeA[1] = iccACurveTagType;iccCurveTypeA[2] = iccACurveTagType;// The data pointer will contain all the curve buffers in a sequential order// The offset of the start of each curve buffer will be saved into the appropriate offset variable in the class// The data pointer will be created automatically inside the toolkit when calling the IccProfile.SetICCTagData()// Define the tag typeIccLookupTableAToBTagType iccLUTAtoB = new IccLookupTableAToBTagType(3, // Input channels1, // Output channelsiccCurveTypeB,iccParametricCurveTypeM,iccCurveTypeA,iccCLUT8,iccMatrix);// Add the new tag to the ICC profileiccProfile.AddTag(iccLUTAtoB, IccTag.AToB2Tag, IccTagTypeBase.LutAtoBTypeSignature);// Generate the new profile IDiccProfile.GenerateProfileId();// Update the ICC array with the new changesiccProfile.UpdateDataArray();// Write the ICC profile into a new fileiccProfile.GenerateIccFile(outputIccProfile);}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}