The LEAD Color Conversion toolkit provides emulation tables as one of its conversion methods. This method however is provided only for the following conversions:
The Emulation tables' method supports both built-in and custom options. For built-in emulation tables, use the ConversionMethodFlags.UseEmulationTables option. The custom emulation tables' option, ConversionMethodFlags.UseCustomEmulationTables, provides custom conversion using user-supplied images, converted from the source images distributed with the library, by any tool, as follows:
Conversion | Source | Convert to |
---|---|---|
CMYK to RGB | src_cmyk_image.tif | RGB image (i.e. dst_cmyk2rgb_image.tif) |
RGB to Lab | src_rgb_image.tif | Lab image (i.e. dst_rgb2lab_image.tif) |
Lab to RGB | src_lab_image.tif | RGB image (i.e. dst_lab2rgb_image.tif) |
A set of images, already converted and ready for use (dst_cmyk2rgb_image.tif, dst_rgb2lab_image.tif, and dst_lab2rgb_image.tif), is provided. However, using the provided set of converted images will produce the same results as the built-in emulation tables.
The code below shows how a conversion can be done using the built-in tables:
vb
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ColorConversion
Private Function BuiltInTablesConvertCmykToRgb(ByVal cmykBuffer As Byte(), ByVal width As Integer, ByVal height As Integer) As Byte()
' StartUp the ColorConversion.
RasterColorConverter.Startup()
' Initialize the Rgb buffer array
Dim rgbBuffer As Byte() = New Byte(cmykBuffer.Length - 1){}
' Initialize a new ConversionParameters class object.
Dim convParams As ConversionParameters = New ConversionParameters()
' Conversion with options.
' The conversion will be done with the options specified in the
' convParams variable
' We want to use built-in emulation tables
convParams.Method = ConversionMethodFlags.UseEmulationTables
' Set the quantization to 8
convParams.Quantization = 8
' set the active conversion method
convParams.ActiveMethod = ConversionMethodFlags.UseEmulationTables
' Initialize a new Converter object
Dim converter As RasterColorConverter = New RasterColorConverter()
Try
' Initialize the color conversion
converter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, convParams)
' Convert the image buffer
converter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0)
' Stop the conversion
converter.Stop()
Catch ex As Exception
MessageBox.Show(ex.Message)
rgbBuffer = Nothing
End Try
' Shutdown the ColorConversion.
RasterColorConverter.Shutdown()
' return the converted buffer.
Return rgbBuffer
End Function
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ColorConversion;
private byte[] BuiltInTablesConvertCmykToRgb(byte[] cmykBuffer, int width, int height)
{
// StartUp the ColorConversion.
RasterColorConverter.Startup();
// Initialize the Rgb buffer array
byte[] rgbBuffer = new byte[cmykBuffer.Length];
// Initialize a new ConversionParameters class object.
ConversionParameters convParams = new ConversionParameters();
// Conversion with options.
// The conversion will be done with the options specified in the
// convParams variable
// We want to use built-in emulation tables
convParams.Method = ConversionMethodFlags.UseEmulationTables;
// set the active conversion method
convParams.ActiveMethod = ConversionMethodFlags.UseEmulationTables;
// set the quantization to 8
convParams.Quantization = 8;
// Initialize a new Converter object
RasterColorConverter converter = new RasterColorConverter();
try
{
// Initialize the color conversion
converter.Start(ConversionColorFormat.Cmyk,
ConversionColorFormat.Rgb,
convParams);
// Convert the image buffer
converter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0);
// Stop the conversion
converter.Stop();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
rgbBuffer = null;
}
// Shutdown the ColorConversion.
RasterColorConverter.Shutdown();
// return the converted buffer.
return rgbBuffer;
}
The code below shows how a conversion can be done using user-defined tables:
vb
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ColorConversion
Private Function UserTablesConvertCmykToRgb(ByVal cmykBuffer As Byte(), ByVal width As Integer, ByVal height As Integer) As Byte()
' StartUp the ColorConversion.
RasterColorConverter.Startup()
' Initialize the Rgb buffer array
Dim rgbBuffer As Byte() = New Byte(cmykBuffer.Length - 1){}
' Initialize a new ConversionParameters class object.
Dim convParams As ConversionParameters = New ConversionParameters()
' Conversion with options.
' The conversion will be done with the options specified in the
' params(variable)
' we want to use custom emulation tables
convParams.Method = ConversionMethodFlags.UseCustomEmulationTables
' set the active conversion method
convParams.ActiveMethod = ConversionMethodFlags.UseCustomEmulationTables
' set the emulation tables
convParams.DestinationInputTable = "C:\LEADTOOLS23\Resources\Images\ET\src_rgb_image.tif"
' Initialize a new Converter object
Dim converter As RasterColorConverter = New RasterColorConverter()
Try
' Initialize the color conversion
converter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, convParams)
' Convert the image buffer
converter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0)
' Stop the conversion
converter.Stop()
Catch ex As Exception
MessageBox.Show(ex.Message)
rgbBuffer = Nothing
End Try
' Shutdown the ColorConversion.
RasterColorConverter.Shutdown()
' return the converted buffer.
Return rgbBuffer
End Function
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ColorConversion;
private byte[] UserTablesConvertCmykToRgb(byte[] cmykBuffer, int width, int height)
{
// StartUp the ColorConversion.
RasterColorConverter.Startup();
// Initialize the Rgb buffer array
byte[] rgbBuffer = new byte[cmykBuffer.Length];
// Initialize a new ConversionParameters class object.
ConversionParameters convParams = new ConversionParameters();
// Conversion with options.
// The conversion will be done with the options specified in the
// params(variable)
// we want to use custom emulation tables
convParams.Method = ConversionMethodFlags.UseCustomEmulationTables;
// set the active conversion method
convParams.ActiveMethod = ConversionMethodFlags.UseCustomEmulationTables;
// set the emulation tables
convParams.DestinationInputTable = @"C:\LEADTOOLS23\Resources\Images\ET\src_rgb_image.tif";
// Initialize a new Converter object
RasterColorConverter converter = new RasterColorConverter();
try
{
// Initialize the color conversion
converter.Start(ConversionColorFormat.Cmyk,
ConversionColorFormat.Rgb,
convParams);
// Convert the image buffer
converter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0);
// Stop the conversion
converter.Stop();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
rgbBuffer = null;
}
// Shutdown the ColorConversion.
RasterColorConverter.Shutdown();
// return the converted buffer.
return rgbBuffer;
}
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.