LEADTOOLS Raster Imaging C DLL Help > Function References > L_SaveFileTile |
#include "l_bitmap.h"
L_LTFIL_API L_INT L_SaveFileTile(pszFile, pBitmap, nCol, nRow, pfnCallback, pUserData, pSaveOptions)
L_TCHAR* pszFile; |
/* file name */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nCol; |
/* left column of tile */ |
L_INT nRow; |
/* top row of tile */ |
FILESAVECALLBACK pfnCallback; |
/* optional callback function */ |
L_VOID* pUserData; |
/* pointer to more parameters for the callback */ |
pSAVEFILEOPTION pSaveOptions; |
/* pointer to optional extended save options */ |
Saves a bitmap to a specified rectangular location in an existing FlashPix file.
Parameter |
Description |
pszFile |
Character string containing the name of the image file to save. |
pBitmap |
Pointer to the bitmap handle for the loaded data. |
nCol |
Left column number of tile. |
nRow |
Top row number of tile. |
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. |
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. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. |
Returns
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
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Win32, x64, Linux.
See Also
Functions: |
|
|
|
Topics: |
|
|
For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 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; }