LFile::FileConvert

#include "ltwrappr.h"

static L_INT LFile::FileConvert(pszFileDst, pszFileSrc, nType, nWidth, nHeight, nBitsPerPixel, nQFactor, pLoadFileOption=NULL, pSaveFileOption=NULL)

L_TCHAR L_FAR * pszFileDst;

/* output file name */

L_TCHAR L_FAR * pszFileSrc;

/* input file name */

L_INT nType;

/* output file format */

L_INT nWidth;

/* width of the new output file */

L_INT nHeight;

/* height of the new output file */

L_INT nBitsPerPixel;

/* output file pixel depth */

L_INT nQFactor;

/* quality factor */

pLOADFILEOPTIONpLoadFileOption;

/* pointer to optional extended load options */

pSAVEFILEOPTIONpSaveFileOption;

/* pointer to optional extended save options */

Converts an image file from one format to another, creating a new file in the new format.

Parameter

Description

pszFileDst

Character string containing the output file name.

pszFileSrc

Character string containing the input 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 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. Q factor is a number that determines the degree of loss in the compression process.

 

For possible values, refer to Compression Quality Factors.

pLoadFileOption

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

pSaveFileOption

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

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.

Required DLLs and Libraries

LTFIL
File format DLLs

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Saving Files

 

Raster Image Functions: Maintaining File Comments and Tags

 

Raster Image Functions: Low-Level Compression Functions

 

Raster Image Functions: Loading and Saving Stamp Images

 

Raster Image Functions: Redirecting Input and Output

 

Raster Image Functions: Input and Output

 

Loading and Saving Images

Example

For an example, refer to LFile::LoadBitmap.