←Select platform

HighQualityRotateCommandFlags Enumeration

Summary
Options for the HighQualityRotateCommand class.
Syntax
C#
Objective-C
C++/CLI
Java
Python
[FlagsAttribute()] 
public enum HighQualityRotateCommandFlags   
typedef NS_OPTIONS(NSUInteger, LTHighQualityRotateCommandFlags) 
public final class HighQualityRotateCommandFlags 
    extends java.lang.Enum<HighQualityRotateCommandFlags> 
[FlagsAttribute()] 
public enum class HighQualityRotateCommandFlags   
class HighQualityRotateCommandFlags(Enum): 
   Crop = 0 
   Crop = 0 
   Crop = 0 
   Fastest, None, Resize = 1 
   Fastest, None, BestQuality = 16 
Members
ValueMemberDescription
0x00000000Crop Crop the resulting image. Since a RasterImage is always a rectangular object, rotation will always increase the width and height of the image. Specifying this flag will keep the original image size by cropping the extra size resulting from the rotation operation. The value specified in HighQualityRotateCommand.FillColor will not be usedThis flag cannot be ORed with Resize.
0x00000000Fastest Use fastest interpolation possible (Bilinear) when rotating.This flag cannot be ORed with BestQuality
0x00000000None Default value. Do not resize the image. Crop it and use fast rotation as opposed to optimal quality. This is the same as specifying the Crop | Fastest flags
0x00000001Resize Size the resulting image as needed. Since a RasterImage is always a rectangular object, rotation will always increase the width and height of the image. Specifying this flag will increase the size of the image and fill the extra space with the value specified in the HighQualityRotateCommand.FillColor property.This flag cannot be ORed with Crop
0x00000010BestQuality Use highest quality interpolation possible (Bicubic) when rotating.This flag cannot be ORed with Fastest
Remarks

You can use a bitwise OR ( | ) to specify one or more flags.

The HighQualityRotateCommandFlags enumeration is used as the type for the HighQualityRotateCommand.Flags property.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
 
public void HighQualityRotateCommandExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // Get an image 
   string tifFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1.tif"); 
   string normalRotateFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_NormalRotated.tif"); 
   string highQualityRotateFileName = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_HighQualityRotated.tif"); 
 
   int angle = 30 * 100; 
   RasterColor fillColor = RasterColor.FromKnownColor(RasterKnownColor.White); 
 
   // Load the image, rotate normally by 30 degrees and save 
   using (RasterImage image = codecs.Load(tifFileName)) 
   { 
      RotateCommand cmd = new RotateCommand(); 
      cmd.Angle = angle; 
      cmd.Flags = RotateCommandFlags.Resize | RotateCommandFlags.Bicubic; 
      cmd.FillColor = fillColor; 
      cmd.Run(image); 
      codecs.Save(image, normalRotateFileName, image.OriginalFormat, image.BitsPerPixel); 
   } 
 
 
   // Load the image, rotate with high quality by 30 degrees and save 
   using (RasterImage image = codecs.Load(tifFileName)) 
   { 
      HighQualityRotateCommand cmd = new HighQualityRotateCommand(); 
      cmd.Angle = angle; 
      cmd.Flags = HighQualityRotateCommandFlags.Resize | HighQualityRotateCommandFlags.BestQuality; 
      cmd.FillColor = fillColor; 
      cmd.Run(image); 
      codecs.Save(image, highQualityRotateFileName, image.OriginalFormat, image.BitsPerPixel); 
   } 
 
   // Now compare the saved TIF files and notice the difference in quality between 
   // the normal rotate and high quality 
 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.*; 
import leadtools.imageprocessing.core.*; 
 
 
public void highQualityRotateCommandExample() { 
 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterCodecs codecs = new RasterCodecs(); 
 
   // Get an image 
   String tifFileName = combine(LEAD_VARS_IMAGES_DIR, "ocr1.tif"); 
   String normalRotateFileName = combine(LEAD_VARS_IMAGES_DIR, "ocr1_NormalRotated.tif"); 
   String highQualityRotateFileName = combine(LEAD_VARS_IMAGES_DIR, "ocr1_HighQualityRotated.tif"); 
 
   int angle = 30 * 100; 
   RasterColor fillColor = RasterColor.fromKnownColor(RasterKnownColor.WHITE); 
 
   // Load the image, rotate normally by 30 degrees and save 
   RasterImage image = codecs.load(tifFileName); 
   RotateCommand cmd = new RotateCommand(); 
   cmd.setAngle(angle); 
   cmd.setFlags(RotateCommandFlags.RESIZE.getValue() | RotateCommandFlags.BICUBIC.getValue()); 
   cmd.setFillColor(fillColor); 
   cmd.run(image); 
   codecs.save(image, normalRotateFileName, image.getOriginalFormat(), image.getBitsPerPixel()); 
   image.dispose(); 
 
   assertTrue(new File(normalRotateFileName).exists()); 
   System.out.println("Command run and image exported to: " + normalRotateFileName); 
 
   // Load the image, rotate with high quality by 30 degrees and save 
   image = codecs.load(tifFileName); 
   HighQualityRotateCommand command = new HighQualityRotateCommand(); 
   command.setAngle(angle); 
   command.setFlags( 
         HighQualityRotateCommandFlags.RESIZE.getValue() | HighQualityRotateCommandFlags.BEST_QUALITY.getValue()); 
   command.setFillColor(fillColor); 
   assertTrue(cmd.getAngle() == 3000 && cmd.getFillColor() == fillColor); 
   command.run(image); 
   codecs.save(image, highQualityRotateFileName, image.getOriginalFormat(), image.getBitsPerPixel()); 
 
   assertTrue(new File(highQualityRotateFileName).exists()); 
   System.out.println("Command run and image exported to: " + highQualityRotateFileName); 
 
   image.dispose(); 
 
   // Now compare the saved TIF files and notice the difference in quality between 
   // the normal rotate and high quality 
 
   codecs.dispose(); 
 
} 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 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.