Gets or sets the white point properties.
public Leadtools.Colorconversion.ConversionWhitePoint WhitePoint {get; set;}Public Property WhitePoint As Leadtools.Colorconversion.ConversionWhitePointpublic:property Leadtools.Colorconversion.ConversionWhitePoint WhitePoint {Leadtools.Colorconversion.ConversionWhitePoint get();void set ( Leadtools.Colorconversion.ConversionWhitePoint );}
The white point properties.
This example will converts RGB to CMYK using built-in conversion.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ColorConversion<TestMethod()> _Public Sub WhitePointExampleExample()' Initialize the RasterCodecs classDim codecs As RasterCodecs = New RasterCodecs' StartUp the ColorConversion.RasterColorConverterEngine.Startup()' The input file nameDim inputFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")' load the input image as Rgb.Dim rgbImage As RasterImage = codecs.Load(inputFileName, 24, CodecsLoadByteOrder.Rgb, 1, 1)' Image buffer arrayDim rgbBuffer(rgbImage.BytesPerLine * rgbImage.Height) As Byte' get image bufferFor i As Integer = 0 To rgbImage.Height - 1rgbImage.GetRow(i, rgbBuffer, (i * rgbImage.BytesPerLine), rgbImage.BytesPerLine)Next' Initialize the Cmyk buffer arrayDim cmykBuffer(CInt(rgbImage.Height * rgbImage.Width * 4)) As Byte' Initialize a new Converter objectDim converter As New RasterColorConverterEngine' Initialize a new ConversionParameters new class object.Dim convParams As ConversionParameters = New ConversionParameters' Initialize the WhitePoint property class.Dim whitePoint As ConversionWhitePoint = ConversionWhitePoint.Empty' Set the WhitePoint property.whitePoint.WhitePoint = ConversionWhitePointType.D50' Set the XWhite property.whitePoint.XWhite = 0' Set the YWhite property.whitePoint.YWhite = 0convParams.WhitePoint = whitePoint' Set the Quantization property.convParams.Quantization = 8' Set the Method property.convParams.Method = ConversionMethodFlags.UseBuiltIn' Set the ActiveMethod property.convParams.ActiveMethod = ConversionMethodFlags.UseBuiltIn' Set GcrLevel property.Dim cmykParameters As New ConversionCmykParameters()cmykParameters.GcrLevel = 150convParams.CmykParameters = cmykParametersTry' Start the ColorConversion.converter.Start(ConversionColorFormat.Rgb, ConversionColorFormat.Cmyk, convParams)' Convert Rgb to CMYK.converter.Convert(rgbBuffer, _0, _cmykBuffer, _0, _rgbImage.Width, _rgbImage.Height, _CInt(rgbImage.BytesPerLine - (rgbImage.Width * (rgbImage.BitsPerPixel / 8))), _0)' Stop the ColorConversion.converter.Stop()' Initialize an image to hold the converted buffer.Dim cmykImage As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, rgbImage.Width, rgbImage.Height, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, IntPtr.Zero, 0)' Start the color conversionconverter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Bgr, convParams)' convert the image bufferconverter.ConvertToImage(cmykBuffer, _0, _cmykImage, _rgbImage.Width, _rgbImage.Height, _0, _CInt(rgbImage.BytesPerLine - (rgbImage.Width * (rgbImage.BitsPerPixel / 8))))' stop the conversionconverter.Stop()' the output File Name.Dim outputFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ResultImage.bmp")' Save the result image.codecs.Save(cmykImage, outputFileName, RasterImageFormat.Bmp, 24)' dispose the used imagesrgbImage.Dispose()cmykImage.Dispose()Catch ex As ExceptionMessageBox.Show(ex.Message)End Try' Shutdown the ColorConversion.RasterColorConverterEngine.Shutdown()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.ColorConversion;public void WhitePointPropertyExample(){// Initialize the RasterCodecs classRasterCodecs codecs = new RasterCodecs();// StartUp the ColorConversion.RasterColorConverterEngine.Startup();// The input file namestring inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");// load the input image as Rgb.RasterImage rgbImage = codecs.Load(inputFileName, 24, CodecsLoadByteOrder.Rgb, 1, 1);// Image buffer arraybyte[] rgbBuffer = new byte[rgbImage.BytesPerLine * rgbImage.Height];// get image bufferfor(int i = 0; i < rgbImage.Height; i ++)rgbImage.GetRow(i, rgbBuffer, i * rgbImage.BytesPerLine, rgbImage.BytesPerLine);// Initialize the Cmyk buffer arraybyte[] cmykBuffer = new byte[rgbImage.Height * rgbImage.Width * 4];// Initialize a new Converter objectRasterColorConverterEngine converter = new RasterColorConverterEngine();// Initialize a new ConversionParameters new class object.ConversionParameters convParams = new ConversionParameters();// Initialize the WhitePoint property class.ConversionWhitePoint whitePoint = ConversionWhitePoint.Empty;// Set the WhitePoint property.whitePoint.WhitePoint = ConversionWhitePointType.D50;// Set the XWhite property.whitePoint.XWhite = 0;// Set the YWhite property.whitePoint.YWhite = 0;convParams.WhitePoint = whitePoint;// Set the Quantization property.convParams.Quantization = 8;// Set the Method property.convParams.Method = ConversionMethodFlags.UseBuiltIn;// Set the ActiveMethod property.convParams.ActiveMethod = ConversionMethodFlags.UseBuiltIn;// Set GcrLevel property.ConversionCmykParameters cmykParameters = new ConversionCmykParameters();cmykParameters.GcrLevel = 150;convParams.CmykParameters = cmykParameters;// Initialize an image to hold the converted buffer.RasterImage cmykImage = null;try{// Start the ColorConversion.converter.Start(ConversionColorFormat.Rgb, ConversionColorFormat.Cmyk, convParams);// Convert Rgb to CMYK.converter.Convert(rgbBuffer,0,cmykBuffer,0,rgbImage.Width,rgbImage.Height,rgbImage.BytesPerLine - (rgbImage.Width * (rgbImage.BitsPerPixel / 8)),0);// Stop the ColorConversion.converter.Stop();// Initialize labImage.cmykImage = new RasterImage(RasterMemoryFlags.Conventional, rgbImage.Width, rgbImage.Height, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, IntPtr.Zero, 0);// Start the color conversionconverter.Start(ConversionColorFormat.Cmyk, ConversionColorFormat.Bgr, convParams);// convert the image bufferconverter.ConvertToImage(cmykBuffer, // converted buffer0, // offset to the beginning of source buffercmykImage, // image to be savergbImage.Width, // pixels widthrgbImage.Height, // pixels height0, // 0 bytes alignrgbImage.BytesPerLine - (rgbImage.Width * (rgbImage.BitsPerPixel / 8)));// stop the conversionconverter.Stop();// the output File Name.string outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "ResultImage.bmp");// Save the result image.codecs.Save(cmykImage, outputFileName, RasterImageFormat.Bmp, 24);// dispose the used imagesrgbImage.Dispose();cmykImage.Dispose();}catch(Exception ex){MessageBox.Show(ex.Message);}// Shutdown the ColorConversion.RasterColorConverterEngine.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: WhitePoint Property (ConversionParameters) - Leadtools.ColorConversion |
Introduction |
Help Version 19.0.2017.3.22
|

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.