Skip to content
GBG Documents & Biometrics Documentation

CImage library

The CImage library in ScanWex expands the image manipulating capabilities that were introduced in the ScanW library. This library is capable of converting image formats and manipulates the internal image acquired by the scanner.

The following are Cimage Library functions:

Finds the image dimension in pixels

Syntax

GetImageDimensions (filename As String, Width As Integer, Height As Integer)

Parameters

Parameter Description
fileName Image file name (or empty string if referring to the internal image)
Width Returns the width of the image (in pixels)
Height Returns the height of the image (in pixels)

Return Values

Value Description
IMG_ERR_FILE_OPEN Failed to open input file
INVALID_INTERNAL_IMAGE Can’t process image; internal image buffer is empty or invalid

Finds the image color scheme and resolution. The color scheme may be set to one of the following:

Color scheme Image description
IMAGE_COLOR_TRUE A TRUE COLOR image (24-bit)
IMAGE_COLOR_256 Contains 256 colors
IMAGE_GRAY_256 Contains 256 gray colors
IMAGE_BW Contains black and white only

Syntax

GetImageProperties (filename As String, color As Integer,
dpi As Integer)

Parameters

Parameter Description
fileName Image file name (or empty string if referring to the internal image)
Color Returns the image color scheme
dpi Returns the image resolution (in DPI)

Return Values

Value Description
IMG_ERR_FILE_OPEN Failed to open input file
INVALID_INTERNAL_IMAGE Can’t process image; internal image buffer is empty or invalid
IMG_ERR_SUCCESS Function processed successfully

Stamps text on an image. The text is printed on the horizontal center of the image. The vertical alignment of the text is set by the vertPos parameter as follows:

IMAGE_TOP Prints the text on the upper portion of the image
IMAGE_MIDDLE Prints the text on the middle portion of the image
IMAGE_BOTTOM Prints the text on the bottom portion of the image

Syntax

TextStamp (sourceFile As String, Text As String, textHeight As Integer, vertLocation As Integer , textColor As Integer, destFile As String)

Parameters

Parameter Description
sourceFile Source image file name (or empty string if referring to the internal image
Text The text to be printed on the image
textHeight The height of the text (in pixels)
VertLocation The location of the text in the image (top, middle, bottom)
textColor The color of the text (RGB)
destFile Destination image file name or an empty string if referring to the internal image

Return Values

Value Description
IMG_ERR_FILE_OPEN Failed to open input file
INVALID_INTERNAL_IMAGE Can’t process image; internal image buffer is empty or invalid
IMG_ERR_BAD_PARAM Bad vertLocation parameter
IMG_ERR_SUCCESS Function processed successfully

Stamps text on an image in the location specified by horizontalPos and verticalPos

The horizontal alignment of the text is set by the horizontalPos parameter:

IMAGE_TOP Prints the text on the upper portion of the image
IMAGE_MIDDLE Prints the text on the middle portion of the image
IMAGE_BOTTOM Prints the text on the bottom portion of the image

The vertical alignment of the text is set by the vertLocation parameter:

IMAGE_LEFT Prints the text on the left portion of the image
IMAGE_ MID_HOR Prints the text on the middle portion of the image
IMAGE_RIGHT Prints the text on the right portion of the image

Syntax

TextStampEx (sourceFile As String, Text As String, color As Long,
opacity As Long, verticalPos As Long, horizontalPos As Long, fontName As String, fontSize As Long, bold As Long, bUnderline As Long, ret As Long)

Parameters

Parameter Description
image Source image file name (or empty string if referring to the internal image)
txt Text to print on the image
color Color of the text (RGB)
Opacity Opacity value of the text color
vertPos Location of the text in the image (top, middle, bottom)
horizontalPos Location of the text in the image (left, middle, right)
fontName Name of the font to use
fontSize Size of the font to use
bold Indicates whether to use boldface
bUnderline Indicates whether to use underline

Return Values

None

Gets a copy of the internal image buffer. If successful, the function formats the image according to the given image format in the sFileType parameter and copy it to the pBuf. The application can dump content of pBuf to the hard drive as a binary file while assigning it a proper file extension, creating a standard image file.

Syntax

GetImageBufferData (sFileType As String, pBuf As String) As Integer

Parameters

Parameter Description
pBuf A string buffer that will contain the image content upon successful return
sFileType Sets the buffer image format. May be one of the following strings (case insensitive): BMP | PNG | JPG | PCX | PSD | TIF | TGA | JPGIR* | JPGUV*
  • If the value JPGIR or JPGUV are used, then the buffer will contain the IR or UV image. Otherwise, the buffer contains the visible image in the requested format.

Return Values

Value Description
BAD_IMAGE_DUMP Function failed
INVALID_INTERNAL_IMAGE Can’t process image; internal image buffer is empty or invalid
IMG_ERR_SUCCESS Function processed successfully

Gets a copy of the internal Back image buffer. If successful, the function will format the image according to the given image format in the parameter sFileType and copy it to the pBuf. The application can dump content of pBuf to the hard drive as a binary file while assigning it a proper file extension, creating a standard image file.

Syntax

GetImageBufferDataBack (sFileType As String, pBuf As String) As Integer

Parameters

Parameter Description
pBuf A string buffer that contains the back image content upon successful return
sFileType Sets the buffer image format. May be one of the following strings (case insensitive): BMP | PNG | JPG | PCX | PSD | TIF | TGA | JPGIR* | JPGUV*
  • If the value JPGIR or JPGUV are used, then the buffer will contain the IR or UV image. Otherwise, the buffer contains the visible image in the requested format.

Return Values

Value Description
BAD_IMAGE_DUMP Failed to dump the Back image buffer; internal error
INVALID_INTERNAL_IMAGE Can’t process back image; internal image buffer is empty or invalid
IMG_ERR_SUCCESS Function processed successfully

Cleans random pixels from black and white images. Such noise may be shown when converting images with gradient color transition from color to black and white color. The higher the value set in maxBlobArea, the more details in the image will be considered.

Syntax

ImgDespeckle (sImageFile As String, maxBlobArea As Integer) As Integer

Parameters

Parameter Description
sImageFileType Source image file name or an empty string if referring to the internal image
maxBlobArea maximum area size (in square pixels) of random pixels that will be considered as noise and will be removed from the image (default is 30)

Return Values

Value Description
IMG_ERR_FILE_OPEN Failed to open input file specified by sImageFile
INVALID_INTERNAL_IMAGE Can’t process image; internal image buffer is empty or invalid
IMG_ERR_SUCCESS Function processed successfully

Selects the current image to use as the main image. Enables image manipulation on the back image (make sure to switch back to the main image once the back image manipulation is done).

Syntax

SetMainImage (iImageType As Integer) As Integer

Parameters

Parameter Description
iImageType Sets the main image buffer index:

Return Values

Value Description
IMG_ERR_BAD_PARAM iImageType is not one of the values 0-3
IMG_ERR_SUCCESS Function processed successfully

The system will try cropping every image loaded by default. Use this function to indicate the system to stop cropping or to restart cropping again.

Syntax

AlwaysFlagAsCropped (bCrop As Boolean)

Parameters

Parameter Description
bCrop Controls the images cropping process TRUE | FALSE. If TRUE, images will not be cropped.

Return Values

Value Description
S_OK

Switches the AcuFill SDK to mobile mode and sets the mobile device configuration. Calling any subsequent processing method (such as DetectState, ProcessState) will use this configuration in the processing pipeline. Setting MobileType to 0 will exit AcuFill SDK mobile mode.

Syntax

SetMobileCfg(mobileType as WORD, mobileDevModel as DWORD, deviceID as BSTR, orgImageW as INT, orgImageH as INT, orgImageBitsPerPixels as INT, fRotAngle as FLOAT, cropRectangle as RECT, fScaleFactor as FLOAT, mountingType as WORD) as Long

Parameters

Parameter Description
[in] mobileType Mobile OS. If mobileType is set to 0 the system exists Mobile mode. This parameter can be one of the following values:
[in] mobileDevModel Specific device model TBD, currently not in use.
[in] deviceID Device unique id (for example Android devices :ANDROID_ID - 64-bit number (as a hex string 16chars), iPhone devices : NSUUID : 32 hex number etc.).
[in] orgImageW Image width as captured by the device (before any process)
[in] orgImageH Image height as captured by the device (before any process)
[in] orgImageBitsPerPixels Camera bits per pixels resolution
[in] fRotAngle Camera rotation angle, use 0 if no rotation applied
[in] cropRectangle Crop rectangle (if the image is cropped), use 0,0,0,0 if no cropping applied
[in] fScaleFactor Scale factor (if the image is scaled), use 1.0 if no scaling applied
[in] mountingType Mounting device (if used). This parameter can be one of the following values:

Return Values

Value Description
ID_TRUE Function succeeded
ID_FALSE Function failed