←Select platform

ConversionParameters Constructor

Summary
Initializes a new instance of the ConversionParameters class.
Syntax
C#
C++/CLI
Python
public: 
ConversionParameters(); 
__init__() # Default constructor 
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ColorConversion; 
 
using Leadtools.ImageProcessing; 
 
public string outputFile = Path.Combine(LEAD_VARS.ImagesDir, "ColorConversion", "ConvertImage.png"); 
 
public void ConvertImageExample() 
{ 
   // StartUp the ColorConversion.  
   RasterColorConverterEngine.Startup(); 
 
   // Input file name 
   string inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "ColorConversion", "11800-Embedded_RGB.png"); 
 
   // Load the original image 
   using (RasterCodecs codecs = new RasterCodecs()) 
   using (RasterImage image = codecs.Load(inputFileName, 24, CodecsLoadByteOrder.Bgr, 1, 1)) 
   { 
      // Set the active method 
      ConversionParameters conversionParameters = new ConversionParameters(); 
      conversionParameters.Method = ConversionMethodFlags.UseCustomIcc; 
      conversionParameters.ActiveMethod = ConversionMethodFlags.UseCustomIcc; 
 
      // Read the embedded profile from image on disk 
      bool hasProfile = IccProfileExtended.ImageHasIccProfile(inputFileName, 1); 
      Debug.WriteLine("Profile present:\t" + hasProfile); 
      IccProfileExtended icc = new IccProfileExtended(); 
      icc.ReadFromImage(inputFileName, 1); 
 
      // Use the image profile as the input profile 
      conversionParameters.InputProfileData = icc.Data; 
 
      // Convert the image 
      using (RasterColorConverterEngine colorConverterEngine = new RasterColorConverterEngine()) 
      { 
         colorConverterEngine.Start(ConversionColorFormat.Bgr, ConversionColorFormat.Bgr, conversionParameters); 
         colorConverterEngine.ConvertImage(image); 
         colorConverterEngine.Stop(); 
      } 
 
      // Save output image 
      codecs.Save(image, outputFile, image.OriginalFormat, image.BitsPerPixel); 
 
      // 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.