L_SaveBitmapList
#include "l_bitmap.h"
L_LTFIL_API L_INT L_SaveBitmapList(lpszFile, hList, nFormat, nBits, nQFactor, pSaveOptions)
L_TCHAR* lpszFile; |
/* output file name */ |
HBITMAPLIST hList; |
/* handle to the list of bitmaps */ |
L_INT nFormat; |
/* output file format */ |
L_INT nBits; |
/* resulting file's pixel depth */ |
L_INT nQFactor; |
/* quality factor */ |
pSAVEFILEOPTION pSaveOptions; |
/* pointer to optional extended save options */ |
Saves a list of bitmaps in a multi-page file.
Parameter |
Description |
lpszFile |
Character string containing the output file name. |
hList |
Handle to the list of bitmaps. |
nFormat |
Output file format. You can save multi-page images in PCX, GIF, and most TIFF file formats (including JTIF, but excluding EXIF). For possible values, refer to Formats of Output Files. |
|
Single image formats are also valid (although only one image can be stored). |
nBits |
Resulting file's pixel depth. For possible values, refer to Formats of Output Files. If nBits is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the pBitmap->BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the pBitmap->BitsPerPixel is 2, the file will be stored as 4 bit. |
nQFactor |
This parameter is used when saving an image file to FILE_CMP, FILE_JPEG, FILE_JPEG_411, FILE_JPEG_422, FILE_TIF_JPEG, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process. |
|
For possible values, refer to Compression Quality Factors. |
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
Single-image formats are also valid for output, but only the first image in the list is saved.
Note: |
More options are available in the SAVEFILEOPTION structure. |
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.
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
Windows 2000 / XP/Vista, Windows CE.
See Also
For a list of functions that utilize the LOADFILEOPTION or SAVEFILEOPTION structures, refer to Functions Utilizing the LOADFILEOPTION or SAVEFILEOPTION structures.
Example
For complete sample code, refer to the CHILD.C module of the DEMO example. This example saves a list of 8-bit bitmaps as an animated GIF file.
L_INT SaveBitmapListExample(HBITMAPLIST hList, pBITMAPHANDLE LeadBitmap ) { L_INT nRet; BITMAPHANDLE TmpBitmap; /* Temporary bitmap handle */ SAVEFILEOPTION SaveFileOption; /* File options when saving */ /* Get a copy of the first image's bitmap handle */ nRet = L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE)); if(nRet != SUCCESS) return nRet; /* Get the default SAVEFILEOPTION values */ nRet = L_GetDefaultSaveFileOption(&SaveFileOption, sizeof(SAVEFILEOPTION)); if(nRet != SUCCESS) return nRet; /* Use the target bitmap's palette as the global palette */ nRet = L_GetBitmapColors(LeadBitmap, 0, 256, SaveFileOption.GlobalPalette); if(nRet != SUCCESS) return nRet; /* Assign the other SAVEFILEOPTION fields */ SaveFileOption.Flags = ESO_GLOBALBACKGROUND|ESO_GLOBALPALETTE; SaveFileOption.GlobalWidth = TmpBitmap.Width; SaveFileOption.GlobalHeight = TmpBitmap.Height; SaveFileOption.GlobalLoop = 0; SaveFileOption.GlobalBackground = LeadBitmap->Background; /* Save the bitmap list as an animated GIF file */ nRet = L_SaveBitmapList(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\testan.gif"), hList, FILE_GIF, 8, 0, &SaveFileOption); if(nRet != SUCCESS) return nRet; return SUCCESS; }