The following steps create a new ICC profile, and add to it 3 tags. The first tag will be created from scratch. The second one will be taken from an existing ICC profile, modified and then added to the new ICC profile. The final tag will be taken from an existing ICC profile and added to the new ICC profile without modifications.
In the "Solution Explorer" window, right-click on "Creating an ICC Profile" project, and select "Add Reference…" from the context menu. In the "Add Reference" dialog box, select the "Browse" tab and browse to the "C:\LEADTOOLS 19\Bin\Dotnet\Win32" folder and select the following DLLs:
and then click the OK button to add the above DLLs to the application.
Switch to Form1 code view (right-click Form1 in the solution explorer then select View Code ) and add the following lines at the beginning of the file:
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ColorConversion
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ColorConversion;
double-click the button1 Button on the form to add the event handler for it and add the following code:
'Fill the oldIccProfile structure as an existing ICC profile from a specific file:
Dim oldIccProfile As New IccProfileExtended("C:\Users\Public\Documents\LEADTOOLS Images\ICCv42.icc")
'Copy the header of the existing ICC profile as it is in the header of the new ICC profile:
Dim header As IccHeader = IccHeader.Empty
header.CmmID = oldIccProfile.Header.CmmID
header.Version = oldIccProfile.Header.Version
header.DeviceClass = oldIccProfile.Header.DeviceClass
header.ColorSpace = oldIccProfile.Header.ColorSpace
header.Pcs = oldIccProfile.Header.Pcs
header.DateTime = oldIccProfile.Header.DateTime
header.ProfileSignature = oldIccProfile.Header.ProfileSignature
header.Platform = oldIccProfile.Header.Platform
header.Flags = oldIccProfile.Header.Flags
header.Manufacturer = oldIccProfile.Header.Manufacturer
header.Model = oldIccProfile.Header.Model
header.Attributes = oldIccProfile.Header.Attributes
header.RenderingIntent = oldIccProfile.Header.RenderingIntent
header.Illuminant = oldIccProfile.Header.Illuminant
header.Creator = oldIccProfile.Header.Creator
'Create tag #1 and call it calibrationDateTimeTag, fill it with the current system time, then insert
'it into the new ICC profile:
' define the systemDateTime class and get the current date and time
Dim systemDateTime As System.DateTime = System.DateTime.Now
Dim dateTimeType As New IccDateTime(CShort(systemDateTime.Year), CShort(systemDateTime.Month), CShort(systemDateTime.Day), CShort(systemDateTime.Hour), CShort(systemDateTime.Minute), CShort(systemDateTime.Second))
Dim dateTimeTagType As New IccDateTimeTagType(dateTimeType)
' add the date/time to the header
header.DateTime = dateTimeType
' create the new ICC Profile, and add the header to it
Dim newIccProfile As New IccProfileExtended()
newIccProfile.Header = header
' Now insert the tag into the new ICC profile
newIccProfile.AddTag(dateTimeTagType, IccTag.CalibrationDateTimeTag, IccTagTypeBase.DateTimeTypeSignature)
'Tag #2 is called the mediaWhitePointTag, and it will be copied from the existing ICC profile, then
'modified with random values that have no useful meaning, and finally inserted into the new ICC profile:
' get mediaWhitePoint tag from the old ICC profile and modify it
Dim xyzTagType As New IccXyzTagType()
xyzTagType = CType(oldIccProfile.GetTag(IccTag.MediaWhitePointTag), IccXyzTagType)
xyzTagType.Data(0).X = IccTools.FromDoubleTo2bFixed2bNumber(0.123)
xyzTagType.Data(0).Y = IccTools.FromDoubleTo2bFixed2bNumber(0.456)
xyzTagType.Data(0).Z = IccTools.FromDoubleTo2bFixed2bNumber(0.789)
' insert it in the new ICC profile
newIccProfile.AddTag(xyzTagType, IccTag.MediaWhitePointTag, IccTagTypeBase.XyzTypeSignature)
' Tag #3 is called the technologyTag, and it will be copied from the existing ICC profile, and inserted
' into the new ICC profile without modifying its values.
' get the technologyTag and keep it as it is
Dim signatureTagType As IccSignatureTagType = CType(oldIccProfile.GetTag(IccTag.TechnologyTag), IccSignatureTagType)
newIccProfile.AddTag(signatureTagType, IccTag.TechnologyTag, IccTagTypeBase.SignatureTypeSignature)
' Generate the Data member of the new ICC profile and create the new ICC profile:
' finally generate the new ICC file
newIccProfile.GenerateProfileId()
newIccProfile.UpdateDataArray()
newIccProfile.GenerateIccFile("C:\Users\Public\Documents\LEADTOOLS Images\NewICCv42VB.icc")
//Fill the oldIccProfile structure as an existing ICC profile from a specific file:
IccProfileExtended oldIccProfile = new IccProfileExtended(@"C:\Users\Public\Documents\LEADTOOLS Images\ICCv42.icc");
//Copy the header of the existing ICC profile as it is in the header of the new ICC profile:
IccHeader header = IccHeader.Empty;
header.CmmID = oldIccProfile.Header.CmmID;
header.Version = oldIccProfile.Header.Version;
header.DeviceClass = oldIccProfile.Header.DeviceClass;
header.ColorSpace = oldIccProfile.Header.ColorSpace;
header.Pcs = oldIccProfile.Header.Pcs;
header.DateTime = oldIccProfile.Header.DateTime;
header.ProfileSignature = oldIccProfile.Header.ProfileSignature;
header.Platform = oldIccProfile.Header.Platform;
header.Flags = oldIccProfile.Header.Flags;
header.Manufacturer = oldIccProfile.Header.Manufacturer;
header.Model = oldIccProfile.Header.Model;
header.Attributes = oldIccProfile.Header.Attributes;
header.RenderingIntent = oldIccProfile.Header.RenderingIntent;
header.Illuminant = oldIccProfile.Header.Illuminant;
header.Creator = oldIccProfile.Header.Creator;
//Create tag #1 and call it calibrationDateTimeTag, fill it with the current system time, then insert
//it into the new ICC profile:
// define the systemDateTime class and get the current date and time
System.DateTime systemDateTime = System.DateTime.Now;
IccDateTime dateTimeType = new IccDateTime((ushort)systemDateTime.Year, (ushort)systemDateTime.Month, (ushort)systemDateTime.Day, (ushort)systemDateTime.Hour, (ushort)systemDateTime.Minute, (ushort)systemDateTime.Second);
IccDateTimeTagType dateTimeTagType = new IccDateTimeTagType(dateTimeType);
// add the date/time to the header
header.DateTime = dateTimeType;
// create the new ICC Profile, and add the header to it
IccProfileExtended newIccProfile = new IccProfileExtended();
newIccProfile.Header = header;
// Now insert the tag into the new ICC profile
newIccProfile.AddTag(dateTimeTagType, IccTag.CalibrationDateTimeTag, IccTagTypeBase.DateTimeTypeSignature);
//Tag #2 is called the mediaWhitePointTag, and it will be copied from the existing ICC profile, then
//modified with random values that have no useful meaning, and finally inserted into the new ICC profile:
// get mediaWhitePoint tag from the old ICC profile and modify it
IccXyzTagType xyzTagType = new IccXyzTagType();
xyzTagType = (IccXyzTagType)oldIccProfile.GetTag(IccTag.MediaWhitePointTag);
xyzTagType.Data[0].X = IccTools.FromDoubleTo2bFixed2bNumber(0.123);
xyzTagType.Data[0].Y = IccTools.FromDoubleTo2bFixed2bNumber(0.456);
xyzTagType.Data[0].Z = IccTools.FromDoubleTo2bFixed2bNumber(0.789);
// insert it in the new ICC profile
newIccProfile.AddTag(xyzTagType, IccTag.MediaWhitePointTag, IccTagTypeBase.XyzTypeSignature);
//Tag #3 is called the technologyTag, and it will be copied from the existing ICC profile, and inserted
//into the new ICC profile without modifying its values.
// get the technologyTag and keep it as it is
IccSignatureTagType signatureTagType = (IccSignatureTagType)oldIccProfile.GetTag(IccTag.TechnologyTag);
newIccProfile.AddTag(signatureTagType, IccTag.TechnologyTag, IccTagTypeBase.SignatureTypeSignature);
//Generate the Data member of the new ICC profile and create the new ICC profile:
// finally generate the new ICC file
newIccProfile.GenerateProfileId();
newIccProfile.UpdateDataArray();
newIccProfile.GenerateIccFile(@"C:\Users\Public\Documents\LEADTOOLS Images\NewICCv42CS.icc");
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
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.