←Select platform

IccLookupTableBToATagType Class

Summary
Contains the lutBToAType tag type data.
Syntax
C#
C++/CLI
Python
public class IccLookupTableBToATagType : IccTagTypeBase 
public ref class IccLookupTableBToATagType : public IccTagTypeBase  
class IccLookupTableBToATagType(IccTagTypeBase): 
Remarks
Example

This example method can be used in creating an "lutBtoAType" mentioned in the ICC.1:2004-10 specification. The following information is used: input channels = 3, output channels = 2.

C#
using Leadtools; 
using Leadtools.ColorConversion; 
 
using Leadtools.Codecs; 
 
public string outputIccProfile = Path.Combine(LEAD_VARS.ImagesDir, "IccLookupTableBToATagType.icc"); 
 
public void IccLookupTableBToATagTypeExample() 
{ 
   // Load an ICC profile 
   string fileName = Path.Combine(LEAD_VARS.ImagesDir, "InputProfile.icc"); 
   IccProfileExtended iccProfile = new IccProfileExtended(fileName); 
 
   // B Curves should be of the same number as Input Channels 
   // They can be either IccCurveTagType or IccResponseCurveTagType 
   // Fill the data 
   IccCurveTagType[] iccCurveTypeB = new IccCurveTagType[3]; 
   ushort[] bCurveData = new ushort[1]; 
   bCurveData[0] = IccTools.FromDoubleToU8Fixed8Number((double)1.0); 
   IccCurve iccBCurve = new IccCurve(bCurveData); 
   IccCurveTagType iccBCurveTagType = new IccCurveTagType(iccBCurve); 
   iccCurveTypeB[0] = iccBCurveTagType; 
   iccCurveTypeB[1] = iccBCurveTagType; 
   iccCurveTypeB[2] = iccBCurveTagType; 
 
   // Define the ICC Matrix 
   int[] 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 Input Channels 
   // They can be either IccCurve or IccResponseCurve 
   // Fill the data 
   IccParametricCurveTagType[] iccParametricCurveTypeM = new IccParametricCurveTagType[3]; 
   int[] parameters = new int[1]; 
   parameters[0] = IccTools.FromDoubleTo2bFixed2bNumber((double)5.0); 
   IccParametricCurve parametricCurve = new IccParametricCurve(IccFunctionsType.Function4Bytes, parameters); 
   IccParametricCurveTagType parametricCurveTagType = new IccParametricCurveTagType(parametricCurve); 
   iccParametricCurveTypeM[0] = parametricCurveTagType; 
   iccParametricCurveTypeM[1] = parametricCurveTagType; 
   iccParametricCurveTypeM[2] = parametricCurveTagType; 
 
   // Define the CLUT 
   IccColorLookupTable16Bit iccCLUT16 = new IccColorLookupTable16Bit(); 
   // Only the first i entries are used, where i is the number of input channels 
   iccCLUT16.NumberOfGridPoints[0] = 1; 
   iccCLUT16.NumberOfGridPoints[1] = 1; 
   iccCLUT16.NumberOfGridPoints[2] = 1; 
   // Set the percision that determines if IccColorLookupTable is used 
   // 1 for 8-bit, and 2 for 16-bit 
   iccCLUT16.Precision = 2; 
   // Padding bytes 
   iccCLUT16.Pad[0] = 0; 
   iccCLUT16.Pad[1] = 0; 
   iccCLUT16.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 * 1 * 1 * 2 (number of output channel) * 2 (Percision) = 4 Bytes = 2 ushort 
   iccCLUT16.Data = new ushort[2]; 
   iccCLUT16.Data[0] = 3; 
   iccCLUT16.Data[1] = 4; 
 
   // A Curves should be of the same number as Output Channels 
   // They can be either IccCurve or IccResponseCurve 
   IccCurveTagType[] iccCurveTypeA = new IccCurveTagType[2]; 
   ushort[] aCurveData = new ushort[1]; 
   aCurveData[0] = IccTools.FromDoubleToU8Fixed8Number((double)1.0); 
   IccCurve iccACurve = new IccCurve(aCurveData); 
   IccCurveTagType iccACurveTagType = new IccCurveTagType(iccACurve); 
   iccCurveTypeA[0] = iccACurveTagType; 
   iccCurveTypeA[1] = 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() method 
 
   // Define the tag type 
   IccLookupTableBToATagType iccLUTBtoA = new IccLookupTableBToATagType( 
      3,    // Input channels 
      2,    // Output channels 
      iccCurveTypeB, 
      iccParametricCurveTypeM, 
      iccCurveTypeA, 
      iccCLUT16, 
      iccMatrix); 
 
   // Add the new tag to the ICC profile 
   iccProfile.AddTag(iccLUTBtoA, IccTag.BToA2Tag, IccTagTypeBase.LutBtoATypeSignature); 
 
   // Generate the new profile ID 
   iccProfile.GenerateProfileId(); 
 
   // Update the ICC array with the new changes 
   iccProfile.UpdateDataArray(); 
 
   // Write the ICC profile into a new file 
   iccProfile.GenerateIccFile(outputIccProfile); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ColorConversion Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.