Luxand FaceSDK – Working With Images
Images are represented as the HImage data type.
C++ Declaration:
typedef int HImage;
C# Declaration:
int Image
Delphi Declaration:
HImage = integer;
PHImage = ^HImage;
Java and Android Declaration:
class HImage {
protected int himage;
};
Python Declaration:
class Image(ctypes.Structure);
FaceSDK provides a number of functions to load images to the internal representation from files, buffers or HBITMAP handles and to save images from the internal representation to files, buffers and HBITMAP handles. Each FSDK_LoadImageFromXXXX function creates a new HImage handle, which can be deleted using the FSDK_FreeImage function.
Note that when you perform multiple stages of recognition on large images (for example, when you first detect a face, and then create its template using FSDK_GetFaceTemplateInRegion), consider first resizing the image to a smaller size to speed up operations. Note that you must resize the image to dimensions no smaller than the InternalResizeWidth parameter of the FSDK_SetFaceDetectionParameters function if you perform face detection, in order to keep the same accuracy of face detection.
FSDK_CreateEmptyImage Function
Creates a handle of an empty image. You don’t need to call this function before calling FSDK_LoadImageFromXXXX since these functions already create the HImage handle. Should be called before using the FSDK_CopyImage, FSDK_ResizeImage, FSDK_RotateImage, FSDK_RotateImageCenter, FSDK_RotateImage90, FSDK_MirrorImage, FSDK_CopyRect, FSDK_CopyRectReplicateBorder functions to create the handle of the destination image.
C++ Syntax:
int FSDK_CreateEmptyImage(HImage* Image);
Delphi Syntax:
function FSDK_CreateEmptyImage (Image: PHImage): integer;
C# Syntax:
int FSDK.CreateEmptyImage(ref int Image);
VB Syntax:
Function FSDKVB_CreateEmptyImage (ByRef Image As Long) As Long
Java and Android Syntax:
int FSDK.CreateEmptyImage(HImage Image);
Parameters:
Image – pointer to HImage for creating the image handle.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.CreateEmptyImage() -> Image;
Return Value:
An empty image.
FSDK_LoadImageFromFile Function
Loads the image from a file and provides the internal handle of this image.
C++ Syntax:
int FSDK_LoadImageFromFile(HImage* Image, char* FileName);
Delphi Syntax:
function FSDK_LoadImageFromFile(Image: PHImage; FileName: PAnsiChar): integer;
C# Syntax:
int FSDK.LoadImageFromFile(ref int Image, string FileName)
VB Syntax:
Function FSDKVB_LoadImageFromFile(ByRef Image As Long, ByVal FileName As String) As Long
Java and Android Syntax:
int FSDK.LoadImageFromFile(HImage Image, String FileName);
CImage Syntax:
int FSDK.CImage(String FileName);
Parameters:
Image – pointer to HImage for receiving the loaded image handle.
FileName – filename of the image to be loaded. FaceSDK supports the JPG, PNG and BMP file formats.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.LoadImageFromFile(fileName: str) -> Image;
// constructor
Image(fileName: str) -> Image;
@staticmethod
def Image.FromFile(fileName: str) -> Image;
Return Value:
An image loaded from file.
Exceptions:
FSDK.FileNotFound
FSDK.BadFileFormat
FSDK.UnsupportedImageExtension
FSDK.IOError
FSDK_LoadImageFromFileW Function
Loads the image from a file path in the Unicode character set and provides the internal handle of this image. The function is available only on Windows platforms.
C++ Syntax:
int FSDK_LoadImageFromFileW(HImage* Image, wchar_t* FileName);
Delphi Syntax:
function FSDK_LoadImageFromFileW(Image: PHImage; FileName: PWideChar): integer;
C# Syntax:
int FSDK.LoadImageFromFileW(ref int Image, string FileName)
Java Syntax:
int FSDK.LoadImageFromFileW(HImage Image, String FileName);
Parameters:
Image – pointer to HImage for receiving the loaded image handle.
FileName – filename of the image to be loaded. FaceSDK supports the JPG, PNG and BMP file formats.
Return Value:
Returns FSDKE_OK if successful.
This function is not available in Visual Basic 6.0.
FSDK_LoadImageFromFileWithAlpha Function
Loads the image with alpha channel from a file.
C++ Syntax:
int FSDK_LoadImageFromFileWithAlpha(HImage* Image, wchar_t* FileName);
Java and Android Syntax:
int FSDK.LoadImageFromFileWithAlpha(HImage Image, String FileName);
Parameters:
Image – pointer to HImage for receiving the loaded image handle.
FileName – filename of the image to be loaded. FaceSDK supports the JPG, PNG and BMP file formats.
Return Value:
Returns FSDKE_OK if successful.
This function is currently available only within MirrorReality SDK.
FSDK_SaveImageToFile Function
Saves an image to a file. When saving to .jpg files, you can set the quality of JPEG compression using the FSDK_SetJpegCompressionQuality function.
C++ Syntax:
int FSDK_SaveImageToFile(HImage Image, char* FileName);
Delphi Syntax:
function FSDK_SaveImageToFile(Image: HImage; FileName: PAnsiChar): integer;
C# Syntax:
int FSDK.SaveImageToFile(int Image, string FileName);
VB Syntax:
Function FSDKVB_SaveImageToFile(ByVal Image As Long, ByVal FileName As String) As Long
Java and Android Syntax:
int FSDK.SaveImageToFile(HImage Image, String FileName);
CImage Syntax:
void FSDK.CImage.Save(string FileName);
Parameters:
Image – internal handle of an image to be saved.
FileName – name of file the image will be saved to. FaceSDK saves images in the BMP, PNG or JPG file format. The format to use is recognized by the extension specified in the FileName parameter.
Return Value:
Returns FSDKE_OK if successful.
Example
int img1;
FSDK_Initialize("");
FSDK_LoadImageFromFile(&img1, "test.bmp"); // load .bmp file
FSDK_SaveImageToFile(img1, "test.jpg"); // save as .jpg
Python Syntax:
def FSDK.SaveImageToFile(image: Image, fileName: str, quality: int = None);
def Image.SaveToFile(fileName: str, quality: int = None);
Return Value:
None
Exceptions:
FSDK.CannotCreateFile
FSDK.IOError
Example:
from fsdk import FSDK
FSDK.Initialize()
img = FSDK.Image("test.bmp") # load .bmp file
# if ‘quality’ is not defined the default or previously set value is used
img.SaveToFile(“test.jpg", quality = 50) # save as .jpg
FSDK_SaveImageToFileW Function
Saves an image to a file path in the Unicode character set. The function is available only on Windows platforms. When saving to .jpg files, you can set the quality of JPEG compression using the FSDK_SetJpegCompressionQuality function.
C++ Syntax:
int FSDK_SaveImageToFileW(HImage Image, wchar_t* FileName);
Delphi Syntax:
function FSDK_SaveImageToFileW(Image: HImage; FileName: PWideChar): integer;
C# Syntax:
int FSDK.SaveImageToFileW(int Image, string FileName);
Java Syntax:
int FSDK.SaveImageToFileW(HImage Image, String FileName);
Parameters:
Image – internal handle of an image to be saved.
FileName – name of file the image will be saved to. FaceSDK saves images in the BMP, PNG or JPG file format. The format to use is recognized by the extension specified in the FileName parameter.
Return Value:
Returns FSDKE_OK if successful.
The function is not available in Visual Basic 6.0
FSDK_LoadImageFromBuffer Function
Loads an image from a buffer and provides the internal handle of this image. The function suggests that the image data is organized in a top-to-bottom order, and the distance between adjacent rows is ScanLine bytes (for example, in the 24-bit image, the ScanLine value might be 3*Width bytes if there is no spacing between adjacent rows). The following image modes are supported:
Mode name |
Meaning |
FSDK_IMAGE_GRAYSCALE_8BIT |
8-bit grayscale image |
FSDK_IMAGE_COLOR_24BIT |
24-bit color image (R, G, B order) |
FSDK_IMAGE_COLOR_32BIT |
32-bit color image with alpha channel (R, G, B, A order) |
C++ Syntax:
int FSDK_LoadImageFromBuffer(HImage* Image, unsigned char* Buffer, int Width, int Height, int ScanLine, FSDK_IMAGEMODE ImageMode);
Delphi Syntax:
function FSDK_LoadImageFromBuffer(Image: PHImage; var Buffer; Width, Height: integer; ScanLine: integer; ImageMode: FSDK_IMAGEMODE): integer;
C# Syntax:
int FSDK.LoadImageFromBuffer(ref int Image, byte[] Buffer, int Width, int Height, int ScanLine, FSDK_IMAGEMODE ImageMode);
VB Syntax:
Function FSDKVB_LoadImageFromBuffer(ByRef Image As Long, ByRef Buffer As Byte, ByVal Width As Long, ByVal Height As Long, ByVal ScanLine As Long, ByVal ImageMode As FSDK_IMAGEMODE) As Long
Android Syntax:
int FSDK.LoadImageFromBuffer(HImage Image, byte Buffer[], int Width, int Height, int ScanLine, FSDK_IMAGEMODE ImageMode);
Java Syntax:
int FSDK.LoadImageFromBuffer(HImage Image, byte Buffer[], int Width, int Height, int ScanLine, int ImageMode);
Parameters:
Image – pointer to HImage for receiving the loaded image handle.
Buffer – pointer to buffer containing image data.
Width – width of an image in pixels.
Height – height of an image in pixels.
ScanLine – distance between adjacent rows in bytes.
ImageMode – mode of an image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.LoadImageFromBuffer(buffer: bytes, width: int, height: int, scanLine: int, imageMode: int) -> Image;
@staticmethod
def Image.FromBuffer(buffer: bytes, width: int, height: int, scanLine: int, colorMode: int) -> Image;
Return Value:
An image loaded from buffer.
Note:
The constants FSDK.IMAGE_GRAYSCALE_8BIT, FSDK.IMAGE_COLOR_24BIT or FSDK.IMAGE_COLOR_32BIT are used as imageMode argument .
FSDK_LoadImageFromJpegBuffer Function
Loads an image from a buffer containing JPEG data, and provides the handle of this image.
C++ Syntax:
int FSDK_LoadImageFromJpegBuffer(HImage* Image, unsigned char* Buffer, unsigned int BufferLength);
Delphi Syntax:
function FSDK_LoadImageFromJpegBuffer(Image: PHImage; var Buffer; BufferLength: integer): integer;
VB Syntax:
Function FSDKVB_LoadImageFromJpegBuffer(ByRef Image As Long, ByRef Buffer As Byte, ByVal BufferLength As Long) As Long
Android Syntax:
int FSDK.LoadImageFromJpegBuffer(HImage Image, byte Buffer[], int BufferLength);
Parameters:
Image - pointer to HImage for receiving the loaded image handle.
Buffer – pointer to the buffer containing the image data in JPEG format (usually loaded from a JPEG file).
BufferLength – size of buffer in bytes.
Return Value:
Returns FSDKE_OK if successful.
This function is not available in .NET and Java.
Python Syntax:
def FSDK.LoadImageFromJpegBuffer(buffer: bytes, bufferLength: int = None) -> Image;
Return Value:
An image loaded from jpeg buffer.
Exception:
FSDK.IOError
Note:
If bufferLength is not defined, an entire buffer is used.
FSDK_LoadImageFromPngBuffer Function
Loads an image from a buffer containing PNG data, and provides the handle of this image.
C++ Syntax:
int FSDK_LoadImageFromPngBuffer(HImage* Image, unsigned char* Buffer, unsigned int BufferLength);
Delphi Syntax:
function FSDK_LoadImageFromPngBuffer(Image: PHImage; var Buffer; BufferLength: integer): integer;
VB Syntax:
Function FSDKVB_LoadImageFromPngBuffer(ByRef Image As Long, ByRef Buffer As Byte, ByVal BufferLength As Long) As Long
Android Syntax:
int FSDK.LoadImageFromPngBuffer(HImage Image, byte Buffer[], int BufferLength);
Parameters:
Image - pointer to HImage for receiving the loaded image handle.
Buffer – pointer to the buffer containing the image data in PNG format (usually loaded from a PNG file).
BufferLength – size of buffer in bytes.
Return Value:
Returns FSDKE_OK if successful.
This function is not available in .NET and Java.
Python Syntax:
def FSDK.LoadImageFromPngBuffer(buffer: bytes, bufferLength: int = None) -> Image;
Return Value:
An image loaded from png buffer.
Exception:
FSDK.IOError
Note:
If bufferLength is not defined, an entire buffer is used.
FSDK_GetImageBufferSize Function
Returns the size of the buffer required to store an image.
C++ Syntax:
int FSDK_GetImageBufferSize(HImage Image, int * BufSize, FSDK_IMAGEMODE ImageMode);
Delphi Syntax:
function FSDK_GetImageBufferSize(Image: HImage; BufSize: PInteger; ImageMode: FSDK_IMAGEMODE): integer;
C# Syntax:
int FSDK.GetImageBufferSize(int Image, ref int BufSize, FSDK_IMAGEMODE ImageMode);
VB Syntax:
Function FSDKVB_GetImageBufferSize(ByVal Image As Long, ByRef BufSize As Long, ByVal ImageMode As FSDK_IMAGEMODE) As Long
Android Syntax:
int FSDK.GetImageBufferSize(HImage Image, int BufSize[], FSDK_IMAGEMODE ImageMode);
Java Syntax:
int FSDK.GetImageBufferSize(HImage Image, int BufSize[], int ImageMode);
Parameters:
Image – internal handle of an image.
BufSize – pointer to an integer variable to store the calculated buffer size.
ImageMode – desired image mode of a buffer.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.GetImageBufferSize(image: image, imageMode: int) -> int;
Return Value:
The size of the buffer required to store an image.
FSDK_SaveImageToBuffer Function
Saves an image to a buffer in the desired image mode. Refer to the FSDK_LoadImageFromBuffer function description to read more about image modes.
C++ Syntax:
int FSDK_SaveImageToBuffer(HImage Image, unsigned char* Buffer, FSDK_IMAGEMODE ImageMode);
Delphi Syntax:
function FSDK_SaveImageToBuffer(Image: HImage; var Buffer; ImageMode: FSDK_IMAGEMODE): integer;
C# Syntax:
int FSDK.SaveImageToBuffer(int Image,out byte[] Buffer, FSDK_IMAGEMODE ImageMode);
VB Syntax:
Function FSDKVB_SaveImageToBuffer(ByVal Image As Long, ByRef Buffer As Byte, ByVal ImageMode As FSDK_IMAGEMODE) As Long
Android Syntax:
int FSDK.SaveImageToBuffer(HImage Image, byte Buffer[], FSDK_IMAGEMODE ImageMode);
Java Syntax:
int FSDK.SaveImageToBuffer(HImage Image, byte Buffer[], int ImageMode);
Parameters:
Image – internal handle of an image to be saved.
Buffer – pointer to the buffer containing the image data.
ImageMode – desired mode an image will be saved in.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def Image.ToBuffer(colorMode: int) -> bytes;
Return Value:
A buffer containing raw image data.
FSDK_LoadImageFromHBitmap Function
Loads the image from an HBITMAP handle and provides the internal handle of this image.
C++ Syntax:
int FSDK_LoadImageFromHBitmap(HImage* Image, HBITMAP* BitmapHandle);
Delphi Syntax:
function FSDK_LoadImageFromHBitmap(Image: PHImage; BitmapHandle: HBitmap): integer;
C# Syntax:
int FSDK.LoadImageFromHBitmap(ref int Image, IntPtr BitmapHandle);
VB Syntax:
Function FSDKVB_LoadImageFromHBitmap(ByRef Image As Long, ByVal BitmapHandle As Integer) As Long
CImage Syntax:
FSDK.CImage(IntPtr BitmapHandle);
Parameters:
Image – pointer to HImage for receiving the loaded image handle.
BitmapHandle – handle of the image to be loaded.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.LoadImageFromHBitmap(bitmapHandle: HBITMAP) -> Image;
// constructor
Image(bitmapHandle: HBITMAP) -> Image;
Return Value:
An image created from HBITMAP Windows handle.
FSDK_SaveImageToHBitmap Function
Creates an HBITMAP handle containing the image.
C++ Syntax:
int FSDK_SaveImageToHBitmap(HImage Image, HBITMAP* BitmapHandle);
Delphi Syntax:
function FSDK_SaveImageToHBitmap(Image: HImage; BitmapHandle: PHBitmap): integer;
C# Syntax:
int FSDK.SaveImageToHBitmap(Int Image, ref IntPtr BitmapHandle);
VB Syntax:
Function FSDKVB_SaveImageToHBitmap(ByVal Image As Long, ByRef BitmapHandle As Integer) As Long
CImage Syntax:
IntPtr FSDK.CImage.GetHbitmap();
Parameters:
Image – internal handle of the image to be saved to HBITMAP.
BitmapHandle – pointer to HBITMAP the created HBITMAP handle will be saved to.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.SaveImageToHBitmap(image: Image) -> HBITMAP;
def Image.GetHBitmap() -> HBITMAP;
Return Value:
An HBITMAP Windows handle containg the image.
FSDK.LoadImageFromCLRImage Function
Loads the image from the System.Drawing.Image object and provides the internal handle of this image.
C# Syntax:
int FSDK.LoadImageFromCLRImage(ref int Image, System.Drawing.Image ImageObject);
CImage Syntax:
FSDK.CImage(System.Drawing.Image ImageObject);
Parameters:
Image – reference to HImage for receiving the loaded image handle.
ImageObject – object of the image to be loaded.
Return Value:
Returns FSDKE_OK if successful.
FSDK.SaveImageToCLRImage Function
Creates a System.Drawing.Image object containing the image.
C# Syntax:
int FSDK.SaveImageToCLRImage(int Image, ref System.Drawing.Image ImageObject);
CImage Syntax:
System.Drawing.Image FSDK.CImage.ToCLRImage();
Parameters:
Image – internal handle of the image to be saved to System.Drawing.Image.
ImageObject – reference to System.Drawing.Image object the image will be saved to.
Return Value:
Returns FSDKE_OK if successful.
FSDK.LoadImageFromAWTImage Function
Loads the image from the java.awt.Image object and provides the internal handle of this image.
Java Syntax:
int FSDK.LoadImageFromAWTImage(HImage Image, java.awt.Image SourceImage, int ImageMode);
Parameters:
Image – HImage for receiving the loaded image.
SourceImage – java.awt.Image object of the image to be loaded.
ImageMode – mode of an image. (See FSDK_LoadImageFromBuffer for more information about image modes.)
Return Value:
Returns FSDKE_OK if successful.
FSDK.SaveImageToAWTImage Function
Creates a java.awt.Image object containing the image.
Java Syntax:
int FSDK.SaveImageToAWTImage(HImage Image, java.awt.Image DestImage[], int ImageMode);
Parameters:
Image – internal handle of the image to be saved to java.awt.Image.
DestImage[] – java.awt.Image object the image will be saved to.
ImageMode – desired mode an image will be saved in.
Return Value:
Returns FSDKE_OK if successful.
FSDK_SetJpegCompressionQuality
Sets the quality of the JPEG compression to use in the FSDK_SaveImageToFile function.
C++ Syntax:
int FSDK_SetJpegCompressionQuality(int Quality);
Delphi Syntax:
function FSDK_SetJpegCompressionQuality(Quality: integer): integer;
C# Syntax:
int FSDK.SetJpegCompressionQuality(int Quality);
VB Syntax:
Function FSDKVB_SetJpegCompressionQuality(ByVal Quality As Long) As Long
Java and Android Syntax:
int FSDK.SetJpegCompressionQuality(int Quality);
Parameters:
Quality – quality of JPEG compression. Varies from 0 to 100.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.SetJpegCompressionQuality(quality: int);
Return Value:
None.
FSDK_GetImageWidth Function
Returns the width of an image.
C++ Syntax:
int FSDK_GetImageWidth(HImage SourceImage, int* Width);
Delphi Syntax:
function FSDK_GetImageWidth(SourceImage: HImage; Width: PInteger): integer;
C# Syntax:
int FSDK.GetImageWidth(int SourceImage, ref int Width);
VB Syntax:
Function FSDKVB_GetImageWidth(ByVal SourceImage As Long, ByRef Width As Long) As Long
Java and Android Syntax:
int FSDK.GetImageWidth(HImage SourceImage, int Width[]);
CImage Syntax:
int FSDK.CImage.Width;
Parameters:
SourceImage – internal handle of an image.
Width – pointer to an integer variable to store the width of an image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.GetImageWidth() -> int;
Image.width # property
Image.size # property for tuple (Image.width, Image.height)
Return Value:
The width of an image.
FSDK_GetImageHeight Function
Returns the height of an image.
C++ Syntax:
int FSDK_GetImageHeight(HImage SourceImage, int* Height);
Delphi Syntax:
function FSDK_GetImageHeight(SourceImage: HImage; Height: PInteger): integer;
C# Syntax:
int FSDK.GetImageHeight(int SourceImage, ref int Height);
VB Syntax:
Function FSDKVB_GetImageHeight(ByVal SourceImage As Long, ByRef Height As Long) As Long
Java and Android Syntax:
int FSDK.GetImageHeight(HImage SourceImage, int Height[]);
CImage Syntax:
int FSDK.CImage.Height;
Parameters:
SourceImage – internal handle of an image.
Height – pointer to an integer variable to store the height of an image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.GetImageHeight() -> int;
Image.height # property
Image.size # property for tuple (Image.width, Image.height)
Return Value:
The height of an image.
FSDK_CopyImage Function
Creates a copy of an image. The handle of the destination image should be created with the FSDK_CreateEmptyImage function.
C++ Syntax:
int FSDK_CopyImage(HImage SourceImage, HImage DestImage);
Delphi Syntax:
function FSDK_CopyImage(SourceImage: HImage; DestImage: HImage): integer;
C# Syntax:
int FSDK.CopyImage(int SourceImage, int DestImage);
VB Syntax:
Function FSDKVB_CopyImage(ByVal SourceImage As Long, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.CopyImage(HImage SourceImage, HImage DestImage);
CImage Syntax:
FSDK.CImage FSDK.CImage.Copy();
Parameters:
SourceImage – handle of an image to be copied.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.CopyImage(sourceImage: Image, destImage: Image) -> Image;
def Image.Copy() -> Image;
Return Value:
The new copy of an image.
FSDK_ResizeImage Function
Changes the size of an image. The handle of the destination image should be created with the FSDK_CreateEmptyImage function.
C++ Syntax:
int FSDK_ResizeImage(HImage SourceImage, double ratio, HImage DestImage);
Delphi Syntax:
function FSDK_ResizeImage(SourceImage: HImage; ratio: double; DestImage: HImage): integer;
C# Syntax:
int FSDK.ResizeImage(int SourceImage, double ratio, int DestImage);
VB Syntax:
Function FSDKVB_ResizeImage(ByVal SourceImage As Long, ByVal ratio As Double, ByVal DestImage As Long) As Long
Java and Android Syntax:
Function FSDKVB_ResizeImage(ByVal SourceImage As Long, ByVal ratio As Double, ByVal DestImage As Long) As Long
CImage Syntax:
FSDK.CImage FSDK.CImage.Resize(double ratio);
Parameters:
SourceImage – handle of an image to be resized.
ratio – factor by which the x and y dimensions of the source image are changed. A factor value greater than 1 corresponds to increasing the image size.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.ResizeImage(sourceImage: Image, ratio: float, destImage: Image) -> Image;
def Image.Resize(ratio: float) -> Image;
Return Value:
The new resized image.
FSDK_RotateImage Function
Rotates an image around its center. The handle of the destination image should be created with the FSDK_CreateEmptyImage function.
C++ Syntax:
int FSDK_RotateImage(HImage SourceImage, double angle, HImage DestImage);
Delphi Syntax:
function FSDK_RotateImage(SourceImage: HImage; angle: double; DestImage: HImage): integer;
C# Syntax:
int FSDK.RotateImage(int SourceImage, double angle, int DestImage);
VB Syntax:
Function FSDKVB_RotateImage(ByVal SourceImage As Long, ByVal angle As Double, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.RotateImage(HImage SourceImage, double angle, HImage DestImage);
CImage Syntax:
FSDK.CImage FSDK.CImage.Rotate(double angle);
Parameters:
SourceImage – handle of an image to be rotated.
angle – rotation angle in degrees.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.RotateImage(sourceImage: Image, angle: float, destImage: Image) -> Image;
def Image.Rotate(angle: float) -> Image;
Return Value:
The new rotated image.
FSDK_RotateImageCenter Function
Rotates an image around an arbitrary center. The handle of the destination image should be created with the FSDK_CreateEmptyImage function.
C++ Syntax:
int FSDK_RotateImageCenter(HImage SourceImage, double angle, double xCenter, double yCenter, HImage DestImage);
Delphi Syntax:
function FSDK_RotateImageCenter(SourceImage: HImage; angle: double; xCenter: double; yCenter: double; DestImage: HImage;): integer;
C# Syntax:
int FSDK.RotateImageCenter(int SourceImage, double angle, double xCenter, double yCenter, int DestImage);
VB Syntax:
Function FSDKVB_RotateImageCenter(ByVal SourceImage As Long, ByVal angle As Double, ByVal xCenter As Double, ByVal yCenter As Double, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.RotateImageCenter(HImage SourceImage, double angle, double xCenter, double yCenter, HImage DestImage);
Parameters:
SourceImage – handle of an image to be rotated.
angle – rotation angle in degrees.
xCenter – the X coordinate of the rotation center.
yCenter – the Y coordinate of the rotation center.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.RotateImageCenter(sourceImage: Image, angle: float, xCenter: float, yCenter: float, destImage: Image) -> Image;
def Image.RotateCenter(angle: float, xc: float, yc: float) -> Image;
Return Value:
TThe new rotated image.
FSDK_RotateImage90 Function
Rotates the image by 90 or 180 degrees clockwise or counter-clockwise. The handle of the destination image should be created with the FSDK_CreateEmptyImage function.
C++ Syntax:
int FSDK_RotateImage90(HImage SourceImage, int Multiplier, HImage DestImage);
Delphi Syntax:
function FSDK_RotateImage90(SourceImage: HImage; Multiplier: integer; DestImage: HImage): integer;
C# Syntax:
int FSDK.RotateImage90(int SourceImage, int Multiplier, int DestImage);
VB Syntax:
Function FSDKVB_RotateImage90(ByVal SourceImage As Long, ByVal Multiplier As Long, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.RotateImage90(HImage SourceImage, int Multiplier, HImage DestImage);
CImage Syntax:
FSDK.CImage FSDK.CImage.Rotate90(int Multiplier);
Parameters:
SourceImage – handle of an image to be rotated.
Multiplier – an integer multiplier of 90 degrees defining the rotation angle. Specify 1 for 90 degrees clockwise, 2 for 180 degrees clockwise; specify -1 for 90 degrees counter-clockwise.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.RotateImage90(sourceImage: Image, multiplier: int, destImage: Image) -> Image;
def Image.Rotate90(multiplier: int = 1) -> Image;
Return Value:
The new rotated image.
FSDK_CopyRect Function
Creates a copy of a rectangular area of an image. The handle of the destination image should be created with the FSDK_CreateEmptyImage function. If some apex of a rectangle is located outside the source image, rectangular areas that do not contain the source image will be black.
C++ Syntax:
int FSDK_CopyRect(HImage SourceImage, int x1, int y1, int x2, int y2, HImage DestImage);
Delphi Syntax:
function FSDK_CopyRect(SourceImage: HImage; x1, y1, x2, y2: integer; DestImage: HImage): integer;
C# Syntax:
int FSDK.CopyRect(int SourceImage, int x1, int y1, int x2, int y2, int DestImage);
VB Syntax:
Function FSDKVB_CopyRect(ByVal SourceImage As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.CopyRect(HImage SourceImage, int x1, int y1, int x2, int y2, HImage DestImage);
CImage Syntax:
FSDK.CImage FSDK.CImage.CopyRect(int x1, int y1, int x2, int y2);
Parameters:
SourceImage – handle of an image to be rotated.
x1 – the X coordinate of the bottom left corner of the copied rectangle.
y1 – the Y coordinate of the bottom left corner of the copied rectangle.
x2 – the X coordinate of the top right corner of the copied rectangle.
y2 – the Y coordinate of the top right corner of the copied rectangle.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.CopyRect(sourceImage: Image, x1: int, y1: int, x2: int, y2: int, destImage: Image) -> Image;
def Image.CopyRect(x1: int, y1: int, x2: int, y2: int) -> Image;
Return Value:
The new cropped image.
FSDK_CopyRectReplicateBorder Function
Creates a copy of a rectangular area of an image and adds replicated border pixels. The handle of the destination image should be created with the FSDK_CreateEmptyImage function. This function copies the source image to the destination image and fills pixels ("border") outside the copied area in the destination image with the values of the nearest source image pixels.
C++ Syntax:
int FSDK_CopyRectReplicateBorder(HImage SourceImage, int x1, int y1, int x2, int y2, HImage DestImage);
Delphi Syntax:
function FSDK_CopyRectReplicateBorder(SourceImage: HImage; x1, y1, x2, y2: integer; DestImage: HImage): integer;
C# Syntax:
int FSDK.CopyRectReplicateBorder(int SourceImage, int x1, int y1, int x2, int y2, int DestImage);
VB Syntax:
Function FSDKVB_CopyRect(ByVal SourceImage As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, ByVal DestImage As Long) As Long
Java and Android Syntax:
int FSDK.CopyRectReplicateBorder(HImage SourceImage, int x1, int y1, int x2, int y2, HImage DestImage);
CImage Syntax:
FSDK.CImage FSDK.CImage.CopyRectReplicateBorder(int x1, int y1, int x2, int y2);
Parameters:
SourceImage – handle of an image to be rotated.
x1 – the X coordinate of the bottom left corner of the copied rectangle.
y1 – the Y coordinate of the bottom left corner of the copied rectangle.
x2 – the X coordinate of the top right corner of the copied rectangle.
y2 – the Y coordinate of the top right corner of the copied rectangle.
DestImage – handle of the destination image.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.CopyRectReplicateBorder(sourceImage: Image, x1: int, y1: int, x2: int, y2: int, destImage: Image) -> Image;
def Image.CopyRectReplicateBorder(x1: int, y1: int, x2: int, y2: int) -> Image;
Return Value:
The new cropped image.
FSDK_MirrorImage Function
Mirrors an image. The function can mirror horizontally and vertically.
C++ Syntax:
int FSDK_MirrorImage(HImage Image, bool UseVerticalMirroringInsteadOfHorizontal);
Delphi Syntax:
function FSDK_MirrorImage(Image: HImage; UseVerticalMirroringInsteadOfHorizontal: boolean): integer;
C# Syntax:
int FSDK.MirrorImage(int Image, bool UseVerticalMirroringInsteadOfHorizontal);
VB Syntax:
Function FSDKVB_MirrorImage(ByVal Image As Long, ByVal UseVerticalMirroringInsteadOfHorizontal As Boolean) As Long
Java and Android Syntax:
int FSDK.MirrorImage(HImage Image, boolean UseVerticalMirroringInsteadOfHorizontal);
CImage Syntax:
FSDK.CImage FSDK.CImage.MirrorVertical();
FSDK.CImage FSDK.CImage.MirrorHorizontal();
Parameters:
Image – handle of the image to be mirrored.
UseVerticalMirroringInsteadOfHorizontal– sets the mirror direction.
TRUE: left-to-right swap;
FALSE: top-to-bottom swap;
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.MirrorImage(image: Image, useVerticalMirroringInsteadOfHorizontal: bool = False) -> Image;
def Image.Mirror(useVerticalMirroringInsteadOfHorizontal: bool = False) -> Image;
Return Value:
Mirrored image.
FSDK_FreeImage Function
Frees the internal representation of an image.
C++ Syntax:
int FSDK_FreeImage(HImage Image);
Delphi Syntax:
function FSDK_FreeImage(Image: HImage): integer;
C# Syntax:
int FSDK.FreeImage(int Image);
VB Syntax:
Function FSDKVB_FreeImage(ByVal Image As Long) As Long
Java and Android Syntax:
int FSDK.FreeImage(HImage Image);
Parameters:
Image – handle of the image to be freed.
Return Value:
Returns FSDKE_OK if successful.
Python Syntax:
def FSDK.FreeImage(image: Image):
def Image.Free();
Return Value:
None.
Note:
The image will be freed automatically if it is not freed by hand.