Contains the lutBToAType tag type data.
public class IccLookupTableBToATagType : IccTagTypeBase
Public Class IccLookupTableBToATagType
Inherits IccTagTypeBase
public ref class IccLookupTableBToATagType : public IccTagTypeBase
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.
using Leadtools;
using Leadtools.ColorConversion;
public IccCurveTagType FillIccCurveTagType()
{
double myDoubleValue = 1.0;
ushort[] curveData = new ushort[1];
curveData[0] = IccTools.FromDoubleToU8Fixed8Number(myDoubleValue);
IccCurve iccCurve = new IccCurve(curveData);
IccCurveTagType iccCurveTagType = new IccCurveTagType(iccCurve);
return iccCurveTagType;
}
public IccParametricCurveTagType FillIccParametricCurveTagType()
{
int[] parameters = new int[1];
parameters[0] = IccTools.FromDoubleTo2bFixed2bNumber(5.0);
IccParametricCurve parametricCurve = new IccParametricCurve(IccFunctionsType.Function4Bytes, parameters);
IccParametricCurveTagType parametricCurveTagType = new IccParametricCurveTagType(parametricCurve);
return parametricCurveTagType;
}
public void IccLookupTableBToATagTypeExample()
{
// load an Icc Profile
string fileName = Path.Combine(LEAD_VARS.ImagesDir, "EmptyIcc.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[] iccCurveType = new IccCurveTagType[3];
iccCurveType[0] = FillIccCurveTagType();
iccCurveType[1] = FillIccCurveTagType();
iccCurveType[2] = FillIccCurveTagType();
// define the "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[] iccParametricCurveType = new IccParametricCurveTagType[3];
iccParametricCurveType[0] = FillIccParametricCurveTagType();
iccParametricCurveType[1] = FillIccParametricCurveTagType();
iccParametricCurveType[2] = FillIccParametricCurveTagType();
// 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;
// the percision that determins if we are using IccColorLookupTable
// 8Bit or 16Bit, 1 for 8-bit, and 2 for 16-bit
iccCLUT16.Precision = 2;
// and then the padding bytes
iccCLUT16.Pad[0] = 0;
iccCLUT16.Pad[1] = 0;
iccCLUT16.Pad[2] = 0;
// and finally 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];
iccCurveTypeA[0] = FillIccCurveTagType();
iccCurveTypeA[1] = FillIccCurveTagType();
// 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
// the IccProfile.SetICCTagData() method
// define the tag type
IccLookupTableBToATagType iccLUTBtoA = new IccLookupTableBToATagType(
3, // input channels
2, // output channels
iccCurveType,
iccParametricCurveType,
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
string IccfileName = Path.Combine(LEAD_VARS.ImagesDir, "IccLookupTableBToATagTypeCS.icc");
iccProfile.GenerateIccFile(IccfileName);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.ColorConversion
Public Function FillIccCurveTagType() As IccCurveTagType
Dim myDoubleValue As Double = 1.5
Dim curveData(0) As UShort
curveData(0) = New UShort()
curveData(0) = IccTools.FromDoubleToU8Fixed8Number(myDoubleValue)
myDoubleValue = IccTools.FromU8Fixed8NumberToDouble(curveData(0))
Dim iccCurve As New IccCurve(curveData)
Dim iccCurveTagType As New IccCurveTagType(iccCurve)
Return iccCurveTagType
End Function
Public Function FillIccParametricCurveTagType() As IccParametricCurveTagType
Dim parameters() As Integer = {IccTools.FromDoubleTo2bFixed2bNumber(5.0)}
Dim parametricCurve As New IccParametricCurve(IccFunctionsType.Function4Bytes, parameters)
Dim parametricCurveTagType As New IccParametricCurveTagType(parametricCurve)
Return parametricCurveTagType
End Function
Public Sub IccLookupTableBToATagTypeExample()
' load an Icc Profile
Dim iccProfile As New IccProfileExtended(Path.Combine(LEAD_VARS.ImagesDir, "EmptyIcc.icc"))
' "B Curves" should be of the same number as Input Channels
' They can be either IccTagCurveType or IccResponseCurveTagType fill the data
Dim iccCurveType() As IccCurveTagType = {FillIccCurveTagType(), FillIccCurveTagType(), FillIccCurveTagType()}
' define the "Matrix"
Dim element() As Integer = {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)}
Dim iccMatrix As New IccMatrix(element)
' "M Curves" should be of the same number as Input Channels
' They can be either IccCurve or IccResponseCurve Fill the data
Dim iccParametricCurveType() As IccParametricCurveTagType = {FillIccParametricCurveTagType(),
FillIccParametricCurveTagType(),
FillIccParametricCurveTagType()}
' define the CLUT
Dim iccCLUT16 As 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
' the percision that determins if we are using IccColorLookupTable
' 8Bit or 16Bit, 1 for 8-bit, and 2 for 16-bit
iccCLUT16.Precision = 2
' and then the padding bytes
iccCLUT16.Pad(0) = 0
iccCLUT16.Pad(1) = 0
iccCLUT16.Pad(2) = 0
' and finally 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
ReDim iccCLUT16.Data(1)
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
Dim iccCurveTypeA() As IccCurveTagType = {FillIccCurveTagType(), FillIccCurveTagType()}
' 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
' the IccProfile.SetICCTagData() method
' define the tag type
Dim iccLUTBtoA As New IccLookupTableBToATagType(3,
2,
iccCurveType,
iccParametricCurveType,
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(Path.Combine(LEAD_VARS.ImagesDir, "IccLookupTableBToATagTypeVB.icc"))
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
IccLookupTableBToATagType Members
Leadtools.ColorConversion Namespace
IccParametricCurveTagType Class
IccResponseCurveSet16TagType Class
IccViewingConditionsTagType Class
IccMultiLocalizedUnicodeTagType Class
IccLookupTableAToBTagType Class
IccProfileSequenceDescriptionTagType Class
IccS15Fixed16ArrayTagType Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.