←Select platform

Start Method

Summary
Initializes the color conversion engine.
Syntax
C#
C++/CLI
Python
def Start(self,srcFormat,destFormat,parameters): 

Parameters

srcFormat
Format of the source data.

destFormat
Format of the output data.

parameters
A ConversionParameters object which contains the conversion properties used in the initialization.

Remarks

The Start method must be called after calling the Startup method and before calling any other LEADTOOLS Color Space methods in the case of indirect conversion. When the color conversion engine is no longer needed, it should be freed by calling Stop. For every call to Start there must be a call to Stop. If parameters is null(Nothing), the default built in conversion is assumed, and any subsequent calls to SetParameters will only affect CMYK conversion parameters. When you choose the conversion method, be sure not to combine the Profiles option (ConversionMethodFlags.ConversionMethodFlags.UseIcc) with the Custom Profiles option (ConversionMethodFlags.ConversionMethodFlags.UseCustomIcc), or the Emulation Tables method (ConversionMethodFlags.ConversionMethodFlags.UseEmulationTables) with the custom Emulation Tables method (ConversionMethodFlags.ConversionMethodFlags.UseCustomEmulationTables). Supports conversion using ICC Devicelink profiles with option ConversionMethodFlags.UseCustomIcc and using it as input profile.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ColorConversion; 
 
using Leadtools.ImageProcessing; 
 
public void StartupExample() 
{ 
   // StartUp the ColorConversion.  
   RasterColorConverterEngine.Startup(); 
 
   // Input file name  
   string inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp"); 
 
   // Load the input image as Bgr 
   using (RasterCodecs codecs = new RasterCodecs()) 
   using (RasterImage bgrImage = codecs.Load(inputFileName, 24, CodecsLoadByteOrder.Bgr, 1, 1)) 
   { 
      // BGR buffer  
      byte[] bgrBuffer = new byte[bgrImage.BytesPerLine * bgrImage.Height]; 
      bgrImage.Access(); 
      bgrImage.GetRow(0, bgrBuffer, 0, bgrImage.BytesPerLine * bgrImage.Height); 
      bgrImage.Release(); 
 
      // CMYK buffer 
      byte[] cmykBuffer = new byte[bgrImage.Height * bgrImage.Width * 4]; 
 
      // Start the color conversion  
      RasterColorConverterEngine rasterColorConverterEngine = new RasterColorConverterEngine(); 
      rasterColorConverterEngine.Start(ConversionColorFormat.Bgr, ConversionColorFormat.Cmyk, null); 
      rasterColorConverterEngine.Convert(bgrBuffer, // input buffer  
         0, // offset from the beginning of the source buffer  
         cmykBuffer, // output buffer  
         0, // offset from the beginning of the destination buffer  
         bgrImage.Width, // pixels width  
         bgrImage.Height, // pixels height  
         bgrImage.BytesPerLine - (bgrImage.Width * (bgrImage.BitsPerPixel / 8)), // Scanline alignment for input buffer 
         0); // Scanline alignment for output buffer 
      rasterColorConverterEngine.Stop(); 
   } 
 
   // Shutdown the ColorConversion.  
   RasterColorConverterEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.10.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ColorConversion Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.