L_SaveFileTile

#include "l_bitmap.h"

L_LTFIL_API L_INT L_SaveFileTile(pszFile, pBitmap, nCol, nRow, pfnCallback, pUserData, pSaveOptions)

Saves a bitmap to a specified rectangular location in an existing FlashPix file.

Parameters

L_TCHAR* pszFile

Character string containing the name of the image file to save.

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle for the loaded data.

L_INT nCol

Left column number of tile.

L_INT nRow

Top row number of tile.

FILESAVECALLBACK pfnCallback

Optional callback function for additional processing.

If you do not provide a callback function, use NULL as the value of this parameter.

If you do provide a callback function, use the function pointer as the value of this parameter.

The callback function must adhere to the function prototype described in FILESAVECALLBACK Function.

L_VOID* pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

If the additional parameters are not needed, you can pass NULL in this parameter.

pSAVEFILEOPTION pSaveOptions

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

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

Comments

Note: More options are available in the SAVEFILEOPTION structure.

This function only works with uncompressed FlashPix files. If a compressed FlashPix file is passed, an error will be returned.

This function supports signed data images, but only DICOM and TIFF formats support signed data. This function will return an error code if you attempt to save a signed image to a format other than DICOM or TIFF.

If the bitmap has a region, the region stored in the bitmap will be saved, if the image is saved as one of the TIFF file formats.

In LEADTOOLS version 17 and up, when saving a colored image (such as a 24-bits per pixel image) to bitonal (1-bit per pixel), the toolkit will not use any dithering when converting the image data. This is done because dithering is not the recommended when converting colored images containing text for document processing such as OCR and Barcode. The resulting text will be fuzzy and hard for a recognition engine to process. To save a colored image as bitonal with Floyd-Stein dithering (the behavior of LEADTOOLS 16.5 and earlier) use the ESO_USEDITHERINGMETHOD along with the BITMAPHANDLE.DitheringMethod as illustrated below:

// 'pBitmap' is a colored BITMAPHANDLE 
// Setup FloydStein dithering: 
bitmapHandle.DitheringMethod = FLOYD_STEIN_DITHERING; 
SAVEFILEOPTION saveOptions = {0}; 
L_GetDefaultSaveFileOption(&saveOptions, sizeof(SAVEFILEOPTION)); 
saveOptions.Flags |= ESO_USEDITHERINGMETHOD; 
// Save the bitmap as 1-bpp with auto-dithering: 
L_SaveBitmap(fileName, &bitmapHandle, FILE_CCITT_GROUP4, 1, 0, &saveOptions); 
// or any other L_SaveBitmapXyz or L_SaveFileXyz functions such as: 
// L_SaveFile(fileName, &bitmapHandle, FILE_CCITT_GROUP4, 1, 0, 0, NULL, NULL, &saveOptions) 

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT SaveFileTileExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE Bitmap; 
   FILEINFO FileInfo; 
 
   memset(&FileInfo, 0, sizeof(FILEINFO)); 
   FileInfo.uStructSize = sizeof(FileInfo); 
 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.FPX")), &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_FileInfo(MAKE_IMAGE_PATH(TEXT("IMAGE1.FPX")), &FileInfo, sizeof(FILEINFO), 0, NULL); 
   if(nRet != SUCCESS) 
   { 
      L_FreeBitmap(&Bitmap); 
      return nRet; 
   } 
 
   // Save a bitmap in the center of the image 
   nRet = L_SaveFileTile(MAKE_IMAGE_PATH(TEXT("TEST.FPX")), &Bitmap, (FileInfo.Width - Bitmap.Width)/2, (FileInfo.Height - Bitmap.Height)/2, NULL, NULL, NULL); 
   L_FreeBitmap(&Bitmap); 
 
   return nRet; 
} 
Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help