←Select platform

ChangeToImageOptions Enumeration

Summary
Options to use when changing a LEADTOOLS Leadtools.RasterImage object to GDI+ System.Drawing.Bitmap.
Syntax
C#
C++/CLI
Python
[FlagsAttribute()] 
public enum ChangeToImageOptions   
[FlagsAttribute()] 
public enum class ChangeToImageOptions   
class ChangeToImageOptions(Enum): 
   None = 0 
   ForceChange = 1 
   NoPalette = 2 
   TopLeftAlways = 4 
Members
ValueMemberDescription
0x00000000None Default
0x00000001ForceChange If the image is not GDI+ compatible, this flag forces the conversion.
0x00000002NoPalette Fail if the image has a palette.
0x00000004TopLeftAlways Force the image to have RasterViewPerspective.TopLeft view perspective.
Remarks

The ChangeToImageOptions are used as an options for the RasterImageConverter.ChangeToImage method.

For more information refer to RasterImage and GDI/GDI+.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public void ChangeToImageExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "GdiPlusImage1.bmp"); 
 
   // Load the image 
   using (RasterImage srcImage = codecs.Load(srcFileName)) 
   { 
      // Convert to GDI+ image 
      ImageIncompatibleReason reason = RasterImageConverter.TestCompatible(srcImage, true); 
      PixelFormat pf = RasterImageConverter.GetNearestPixelFormat(srcImage); 
      Console.WriteLine("TestCompatible: {0}", reason); 
      Console.WriteLine("GetNearestPixelFormat:{0}", pf); 
 
      if (reason != ImageIncompatibleReason.Compatible) 
      { 
         RasterImageConverter.MakeCompatible(srcImage, pf, true); 
      } 
 
      using (Image destImage = RasterImageConverter.ChangeToImage(srcImage, ChangeToImageOptions.ForceChange)) 
      { 
         // Save this image to disk 
         destImage.Save(destFileName, ImageFormat.Bmp); 
      } 
   } 
 
   // Clean up 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Drawing Namespace

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

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