CopyImageCommand Class
Syntax
C#
VB
Objective-C
C++
Java
@interface LTKernelCopyImageCommand : LTRasterCommand
public class CopyImageCommand extends RasterCommand
Remarks
After the command is run, a copy of the current page of the source image will be in the CopyImageCommand.DestinationImage property. This property will hold a copy of the image, so the user is responsible for freeing this image after using it.
This command supports 12- and 16-bit grayscale and 48- and 64-bit color images. Support for 12- and 16-bit grayscale and 48- and 64-bit color images is available only in the Document/Medical Imaging toolkits.
This command supports unsigned data images, but not signed ones.
This command does not support 32-bit grayscale images.
This function can only process entire images. It does not support regions.
Note: All RasterCommands in this assembly modify the underlying properties of the input RasterImage, including but not limited to:
- BitsPerPixel
- Data
- IsMirrored
If you wish to avoid RasterImage property fidelity loss, pass a clone of your RasterImage to all RasterCommands in this assembly.
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Kernel;
public void CopyImageCommandExample()
{
using (RasterCodecs codecs = new RasterCodecs())
{
// Load an image
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PerspectiveDeskew.jpg")))
{
CopyImageCommand command = new CopyImageCommand();
command.Run(image);
codecs.Save(command.DestinationImage, Path.Combine(LEAD_VARS.ImagesDir, "ClonedImage.bmp"), RasterImageFormat.Bmp, 24);
// Free cloned image
command.DestinationImage.Dispose();
}
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Kernel
Public Sub CopyImageCommandExample()
Using codecs As RasterCodecs = New RasterCodecs()
Using image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "PerspectiveDeskew.jpg"))
Dim command As CopyImageCommand = New CopyImageCommand()
command.Run(image)
codecs.Save(command.DestinationImage, Path.Combine(LEAD_VARS.ImagesDir, "ClonedImage.bmp"), RasterImageFormat.Bmp, 24)
' Free cloned image
command.DestinationImage.Dispose()
End Using
End Using
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class