#include "l_bitmap.h"
L_LTFIL_API L_INT L_FileConvert(pszFileSrc, pszFileDst, nType, nWidth, nHeight, nBitsPerPixel, nQFactor, pLoadOptions, pSaveOptions, pFileInfo)
L_TCHAR* pszFileSrc; |
input file name |
L_TCHAR* pszFileDst; |
output file name |
L_INT nType; |
output file format |
L_INT nWidth; |
new width of the output file |
L_INT nHeight; |
new height of the output file |
L_INT nBitsPerPixel; |
output file pixel depth |
L_INT nQFactor; |
quality factor |
pLOADFILEOPTION pLoadOptions; |
pointer to optional extended load options |
pSAVEFILEOPTION pSaveOptions; |
pointer to optional extended save options |
pFILEINFO pFileInfo; |
pointer to a structure |
Converts an image file from one format to another, creating a new file in the new format.
Parameter |
Description |
pszFileSrc |
Character string containing the input file name. |
pszFileDst |
Character string containing the output file name. |
nType |
Output file format. For valid values, refer to Formats of Output Files. |
nWidth |
The new width of the output file. If this value is not 0, then the output file will be resized to the nWidth value. Use a value of 0 if you do not wish to resize the output file. |
nHeight |
The new height of the output file. If this value is not 0, then the output file will be resized to the nHeight value. Use a value of 0 if you do not wish to resize the output file. |
nBitsPerPixel |
The output file pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. |
nQFactor |
This parameter is used when saving an image to file format that supports quality factor (QFactor). QFactor is a number that determines the degree of loss in the compression process. |
|
For possible values, refer to Compression Quality Factors. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. |
pFileInfo |
Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded. |
|
Never pass an uninitialized FILEINFO structure. If nothing is known about the file, pass NULL for this parameter; or declare a variable of type FILEINFO and set the FILEINFO.Flags to 0, then pass the address of the FILEINFO structure in this parameter. In this last case, if the address of a FILEINFO structure is passed the FILEINFO structure will be updated with the results of L_FileInfo. |
|
If only the file type is known, set pFileInfo.Format to the file type and set pFileInfo.Flags to FILEINFO_FORMATVALID. This can also be done if L_FileInfo has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling L_SetPCDResolution or L_SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of L_FileInfo. |
|
If L_FileInfo has been called prior to calling this function, and no changes have been made to the contents of the structure filled by L_FileInfo, then the address of the filled FILEINFO structure can be passed for this parameter. In this case, the FILEINFO.Flags member should be set to FILEINFO_INFOVALID. The L_FileInfo function will set the FILEINFO.Flags to FILEINFO_INFOVALID. In this case the load will be faster since this function does not have to query the file filters for the file type. |
|
Note: Local variables are not initialized (since they are placed on the stack). So if you have a FILEINFO structure as a local variable, the value of its Flags parameter is undefined, possibly having FILEINFO_INFOVALID or FILEINFO_FORMATVALID set. That is why it is important to initialize FILEINFO.Flags before passing the address of the FILEINFO structure to the function. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
If you convert to a lower bits-per-pixel format, this function optimizes the colors automatically. For example, when converting a 24-bit file (16 million colors) to an 8-bit file (256 colors) this function selects the best 256 colors to represent the 24-bit image.
L_FileConvert is a high-level function that performs conversions from all possible formats to all possible formats.
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
NOTE: You should never pass an uninitialized FILEINFO structure to this function.
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.
Functions: |
|
Topics: |
|
|
|
|
|
|
|
|
|
|
|
|
For complete sample code, refer to the FRAME.C module of the DEMO example. This example converts a LEAD CMP file to a Windows BMP file
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT FileConvertExample(L_VOID)
{
L_INT nRet;
nRet = L_FileConvert(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), /* Input file */
MAKE_IMAGE_PATH(TEXT("TEST.BMP")), /* Output file */
FILE_BMP, /* Windows BMP file for output */
0, /* Keep the same width */
0, /* Keep the same height */
8, /* 8 bits per pixel */
0, /* No quality factor is used for BMP */
NULL,
NULL, NULL);
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET