#include "ltimgkrn.h"

L_LTIMGKRN_API L_INT L_ImgKrnCopyImage(srcBitmap, destBitmap, structSize)

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



Pointer to the source bitmap handle. A valid image must be loaded into the bitmap for this function to work.


Pointer to the destination bitmap handle to hold the copied image.

L_UINT structSize

Size in bytes, of the structure pointed to by destBitmap, for versioning. Use sizeof(BITMAPHANDLE).


Value Meaning
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.

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.

Required DLLs and Libraries


Win32, x64, Linux.

See Also




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 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help