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:
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ColorConversionPrivate 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 arrayDim 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 tablesconvParams.Method = ConversionMethodFlags.UseEmulationTables' Set the quantization to 8convParams.Quantization = 8' set the active conversion methodconvParams.ActiveMethod = ConversionMethodFlags.UseEmulationTables' Initialize a new Converter objectDim converter As RasterColorConverter = New RasterColorConverter()Try' Initialize the color conversionconverter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, convParams)' Convert the image bufferconverter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0)' Stop the conversionconverter.Stop()Catch ex As ExceptionMessageBox.Show(ex.Message)rgbBuffer = NothingEnd Try' Shutdown the ColorConversion.RasterColorConverter.Shutdown()' return the converted buffer.Return rgbBufferEnd 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 arraybyte[] 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 tablesconvParams.Method = ConversionMethodFlags.UseEmulationTables;// set the active conversion methodconvParams.ActiveMethod = ConversionMethodFlags.UseEmulationTables;// set the quantization to 8convParams.Quantization = 8;// Initialize a new Converter objectRasterColorConverter converter = new RasterColorConverter();try{// Initialize the color conversionconverter.Start(ConversionColorFormat.Cmyk,ConversionColorFormat.Rgb,convParams);// Convert the image bufferconverter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0);// Stop the conversionconverter.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:
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ColorConversionPrivate 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 arrayDim 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 tablesconvParams.Method = ConversionMethodFlags.UseCustomEmulationTables' set the active conversion methodconvParams.ActiveMethod = ConversionMethodFlags.UseCustomEmulationTables' set the emulation tablesconvParams.DestinationInputTable = "C:\Users\Public\Documents\LEADTOOLS Images\ET\src_rgb_image.tif"' Initialize a new Converter objectDim converter As RasterColorConverter = New RasterColorConverter()Try' Initialize the color conversionconverter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, convParams)' Convert the image bufferconverter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0)' Stop the conversionconverter.Stop()Catch ex As ExceptionMessageBox.Show(ex.Message)rgbBuffer = NothingEnd Try' Shutdown the ColorConversion.RasterColorConverter.Shutdown()' return the converted buffer.Return rgbBufferEnd 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 arraybyte[] 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 tablesconvParams.Method = ConversionMethodFlags.UseCustomEmulationTables;// set the active conversion methodconvParams.ActiveMethod = ConversionMethodFlags.UseCustomEmulationTables;// set the emulation tablesconvParams.DestinationInputTable = @"C:\Users\Public\Documents\LEADTOOLS Images\ET\src_rgb_image.tif";// Initialize a new Converter objectRasterColorConverter converter = new RasterColorConverter();try{// Initialize the color conversionconverter.Start(ConversionColorFormat.Cmyk,ConversionColorFormat.Rgb,convParams);// Convert the image bufferconverter.Convert(cmykBuffer, 0, rgbBuffer, 0, width, height, 0, 0);// Stop the conversionconverter.Stop();}catch (Exception ex){MessageBox.Show(ex.Message);rgbBuffer = null;}// Shutdown the ColorConversion.RasterColorConverter.Shutdown();// return the converted buffer.return rgbBuffer;}
|
|

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.