public class HighQualityRotateCommand : RasterCommand Public Class HighQualityRotateCommandInherits RasterCommand
@interface LTHighQualityRotateCommand : LTRasterCommand public class HighQualityRotateCommand extends RasterCommand public ref class HighQualityRotateCommand : public RasterCommand The HighQualityRotateCommand can be used to perform high quality rotation on a black and white (1 bits/pixel) images in any angle.
Normal rotation commands such as RotateCommand will rotate the image data as is, which may result in less than desired quality due to the limited number of bits/pixel of the image (1 bit). This command will temporarily convert the image to 8 bits/pixel internally, perform the rotation and then convert the image back to 1 bits/pixel.
This command only works with a 1 bits/pixel images (a RasterImage with RasterImage.BitsPerPixel equals to 1). Using this command on any other image type will result in an exception.
This command does not support signed data images.
For more information, refer to Cleaning Up 1-Bit Images.
This example will show the difference between normal rotation (RotateCommand) and high quality rotation (HighQualityRotateCommand) when performed on a 1 bits/pixel image.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Core;public void HighQualityRotateCommandExample(){RasterCodecs codecs = new RasterCodecs();// Get an imagestring 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 saveusing (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 saveusing (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 qualitycodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.CoreImports Leadtools.ImageProcessingPublic Sub HighQualityRotateCommandExample()Dim codecs As New RasterCodecs()' Get an imageDim tifFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ocr1.tif")Dim normalRotateFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_NormalRotated.tif")Dim highQualityRotateFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ocr1_HighQualityRotated.tif")Dim angle As Integer = 30 * 100Dim fillColor As RasterColor = RasterColor.FromKnownColor(RasterKnownColor.White)' Load the image, rotate normally by 30 degrees and saveUsing image As RasterImage = codecs.Load(tifFileName)Dim cmd As New RotateCommand()cmd.Angle = anglecmd.Flags = RotateCommandFlags.Resize Or RotateCommandFlags.Bicubiccmd.FillColor = fillColorcmd.Run(image)codecs.Save(image, normalRotateFileName, image.OriginalFormat, image.BitsPerPixel)End Using' Load the image, rotate with high quality by 30 degrees and saveUsing image As RasterImage = codecs.Load(tifFileName)Dim cmd As New HighQualityRotateCommand()cmd.Angle = anglecmd.Flags = HighQualityRotateCommandFlags.Resize Or HighQualityRotateCommandFlags.BestQualitycmd.FillColor = fillColorcmd.Run(image)codecs.Save(image, highQualityRotateFileName, image.OriginalFormat, image.BitsPerPixel)End Using' Now compare the saved TIF files and notice the difference in quality between' the normal rotate and high qualitycodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
HighQualityRotateCommand Members
Leadtools.ImageProcessing.Core Namespace
HighQualityRotateCommand Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
