static L_INT LFile::FileConvert(pszFileDst, pszFileSrc, nType, nWidth, nHeight, nBitsPerPixel, nQFactor, pLoadFileOption=NULL, pSaveFileOption=NULL, pFileInfo)
Converts an image file from one format to another, creating a new file in the new format.
Character string containing the output file name.
Character string containing the input file name.
Output file format. For valid values, refer to Files To Be Included With Your Application.
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.
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.
The output file pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Files To Be Included With Your Application.
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.
Pointer to optional extended load options. Pass NULL to use the default load options.
Pointer to optional extended save options. Pass NULL to use the default save options.
Pointer to optional extended load options. Pass NULL to use the default load options.
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 case, if the address of a FILEINFO structure is passed, the FILEINFO structure will be updated with the results of LFile::GetInfo.
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 LFile::GetInfo has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling LFileSettings::SetPCDResolution or LFileSettings::SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of LFile::GetInfo.
If LFile::GetInfo has been called prior to calling this function, and no changes have been made to the contents of the structure filled by LFile::GetInfo, 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 LFile::GetInfo 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.
Value | Meaning |
---|---|
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.
Note that this is a high-level function that does conversion 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 LBase::EnableStatusCallBack.
Note: You should never pass an uninitialized FILEINFO structure to this function.
Win32, x64.
For an example, refer to LFile::Load.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document