#include "ltimgkrn.h"

L_LTIMGKRN_API L_INT L_ImgKrnCopyImage(srcBitmap, destBitmap, structSize)

BITMAPHANDLE *srcBitmap; source bitmap handle
BITMAPHANDLE *destBitmap; destination bitmap handle
L_UINT structSize; size in bytes, of the structure pointed to by dstBitmap

Copies an entire image of a source bitmap and places it into a destination bitmap. This also copies all fields in the bitmap handle.

Parameter Description
srcBitmap Pointer to the source bitmap handle. A valid image must be loaded into the bitmap for this function to work.
destBitmap Pointer to the destination bitmap handle to hold the copied image.
structSize Size in bytes, of the structure pointed to by destBitmap, for versioning. Use sizeof(BITMAPHANDLE).


SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


The destination bitmap must not be allocated before this function is called.

This function 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 function supports unsigned data images, but not signed ones.

This function does not support 32-bit grayscale images.

Required DLLs and Libraries

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.


Win32, x64, Linux.

Note: All functions with the L_ImgKrn prefix modify the underlying properties of the input BITMAPHANDLE, including but not limited to:

To avoid BITMAPHANDLE property fidelity loss, pass a copy of your BITMAPHANDLE to all L_ImgKrn* functions.

See Also

Functions: L_ImgKrnCreateImage, L_ImgKrnCropImage, L_ImgKrnDetectDocument, L_ImgKrnDetectGlare, L_ImgKrnFromYUV, L_ImgKrnInvertImage, L_ImgKrnManualPerspectiveCorrection, L_ImgKrnRotateFlipImage, L_ImgKrnSignalToNoiseRatio

Raster Image Functions: Copying Images


This example loads a bitmap and copies it to a Kernel LeadBitmap.

L_INT KrnCopyImageExample(L_VOID) 
   L_INT ret = SUCCESS; 
   BITMAPHANDLE srcBitmap; /* Bitmap handle to hold the loaded image. */ 
   BITMAPHANDLE resultBitmap; /* Resulting bitmap */ 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   ret = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &srcBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(ret != SUCCESS) 
      return ret; 
   // Copy the bitmap 
   ret = L_ImgKrnCopyImage(&srcBitmap, &resultBitmap, sizeof(BITMAPHANDLE)); 
   // Free the bitmaps if the bitmaps no longer needed 
   if (ret == SUCCESS) 
   return ret; 

Help Version 20.0.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help