←Select platform

Flags Property

Summary
Options to only check or perform auto-correction on the image.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public InvertedPageCommandFlags Flags { get; set; } 
@property (nonatomic, assign) LTInvertedPageCommandFlags flags; 
public int getFlags(); 
public void setFlags( 
   int intValue 
); 
public: 
property InvertedPageCommandFlags Flags { 
   InvertedPageCommandFlags get(); 
   void set (    InvertedPageCommandFlags ); 
} 
Flags # get and set (InvertedPageCommand) 

Property Value

One or more InvertedPageCommandFlags enumeration members ORed together.

Remarks

If InvertedPageCommandFlags.Process is specified, then the image is auto-corrected if it is inverted and the value of the IsInverted property will be updated accordingly.

If InvertedPageCommandFlags.NoProcess is specified, then the image is only checked for inversion and the value of IsInverted updated without changing the image data.

For more information, refer to InvertedPageCommandFlags enumeration.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
 
public void InvertedPageCommandExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // Get an image 
   string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1.tif"); 
   string invertedImageFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_Inverted.tif"); 
   string nonInvertedImageFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_NonInverted.tif"); 
 
   RasterImage image = codecs.Load(tifFileName); 
 
   // The images should be non-inverted at the beginning, check 
   InvertedPageCommand invertedPage = new InvertedPageCommand(InvertedPageCommandFlags.NoProcess); 
   invertedPage.Run(image); 
   Console.WriteLine("Original image, inverted = {0}", invertedPage.IsInverted); 
 
   // Invert the image 
   InvertCommand invert = new InvertCommand(); 
   invert.Run(image); 
 
   codecs.Save(image, invertedImageFileName, image.OriginalFormat, image.BitsPerPixel); 
 
   // Check again 
   invertedPage.Run(image); 
   Console.WriteLine("After running InvertCommand, inverted = {0}", invertedPage.IsInverted); 
 
   // Now run the command to un-invert the image 
   invertedPage.Flags = InvertedPageCommandFlags.Process; 
   invertedPage.Run(image); 
 
   // Now check the image again 
   invertedPage.Flags = InvertedPageCommandFlags.NoProcess; 
   invertedPage.Run(image); 
   Console.WriteLine("After running InvertedPageCommand, inverted = {0}", invertedPage.IsInverted); 
   codecs.Save(image, nonInvertedImageFileName, image.OriginalFormat, image.BitsPerPixel); 
 
   image.Dispose(); 
 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.ImageProcessing.Core Assembly

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