←Select platform

IccColorLookupTable8Bit Class

Summary
Contains the color lookup table data (CLUT) encoding for the lutAtoBType or lutBToAType tag types.
Syntax
C#
C++/CLI
Python
public class IccColorLookupTable8Bit : IccColorLookupTableBase 
public ref class IccColorLookupTable8Bit : public IccColorLookupTableBase  
class IccColorLookupTable8Bit(IccColorLookupTableBase): 
Example
C#
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 profile 
   string 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 tag 
   IccCurveTagType[] 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 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 Output Channels 
   // They can be either IccCurve or IccResponseCurve 
   // Fill the tag 
   IccParametricCurveTagType[] 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 CLUT 
   IccColorLookupTable8Bit iccCLUT8 = new IccColorLookupTable8Bit(); 
   // Only the first i entries are used, where i is the number of input channels 
   iccCLUT8.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-bit 
   iccCLUT8.Precision = 1; 
   // Padding bytes 
   iccCLUT8.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) = 6 
   iccCLUT8.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 IccResponseCurve 
   ushort[] aCurveData = new ushort[1]; 
   aCurveData[0] = IccTools.FromDoubleToU8Fixed8Number(1.0); 
   IccCurve iccACurve = new IccCurve(aCurveData); 
   IccCurveTagType iccACurveTagType = new IccCurveTagType(iccACurve); 
 
   // Fill the tags 
   IccCurveTagType[] 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 type 
   IccLookupTableAToBTagType iccLUTAtoB = new IccLookupTableAToBTagType( 
      3,    // Input channels 
      1,    // Output channels 
      iccCurveTypeB, 
      iccParametricCurveTypeM, 
      iccCurveTypeA, 
      iccCLUT8, 
      iccMatrix); 
 
   // Add the new tag to the ICC profile 
   iccProfile.AddTag(iccLUTAtoB, IccTag.AToB2Tag, IccTagTypeBase.LutAtoBTypeSignature); 
 
   // 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.10.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.