03-06-2008, 7:08
|
dgVisioscopie
Joined on 01-24-2006
Posts 10
|
|
|
Hello,
I'm using LeadTools 15 with C#.
I have an RGB image. Before printing this image, i want to convert it to CMYK, by using an ICC profile.
I can do a conversion of an image with the original profiles of Leadtools, but when I want to use a custom ICC profile, I can't because the method
"converter.Start" raises an exception with a message "Invalid parameter passed".
I took example of the InputProfilePropertyExample:
When I copy, paste it and execute the code with two ICC profiles of mine, it generates me a RasterException.
public void InputProfilePropertyExample()
{
// StartUp the ColorConversion.
RasterColorConverter.Startup();
// Rgb and Cmyk color buffer arrays
byte[] rgbColor = new byte[3];
byte[] cmykColor = {100, 100, 100, 100};
// Initialize a new ConversionParameters class object.
ConversionParameters convParams = new ConversionParameters();
// Set the Method property
convParams.Method = ConversionMethodFlags.UseCustomIcc;
// Set the ActiveMethod property.
convParams.ActiveMethod = ConversionMethodFlags.UseCustomIcc;
// Initialize the White property class
ConversionWhitePoint whitePoint = ConversionWhitePoint.Empty;
// Set the WhitePoint property
whitePoint.WhitePoint = ConversionWhitePointType.D50;
convParams.WhitePoint = whitePoint;
// Set the InputProfile property
convParams.InputProfile = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\MyCmykProfile.icm";
// Set the InputProfileData property
convParams.InputProfileData = null;
// Set the OutputProfile property
convParams.OutputProfile = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\MyRgbProfile.icm";
// Set the OutputProfileData property
convParams.OutputProfileData = null;
// Set the DestinationInputTable property
convParams.DestinationInputTable = string.Empty;
// Initialize a new Converter object
RasterColorConverter converter = new RasterColorConverter();
try
{
// Start conversion
converter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Rgb, convParams);
// Convert the cmyk color to rgb
converter.Convert(cmykColor, 0, rgbColor, 0, 1, 1, 0, 0);
// Stop conversion
converter.Stop();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
//.
//.
//.
// use rgbColor as you need.
// Shutdown the ColorConversion.
RasterColorConverter.Shutdown();
}
Replacing the two Leadtools examples profiles (MyRgbProfile.icm and MyCmykProfile.icm) by 2 of mine, executing the method "converter.Start(...)", I always catch an exception, with my profiles and the one of Leadtools or any other profile.
Do you have some proposition?
Thank you.
David
|
|
|
|
|
Report
|
|
|
|