LEADTOOLS Raster Imaging C++ Class Library Help > Classes and Member Functions > LFile > LFile Member Functions > LFile::TransformFile |
#include "ltwrappr.h"
virtual L_INT LFile::TransformFile(pszFileDst, uTransform, pLoadOptions=NULL)
L_TCHAR * pszFileDst; |
/* name of the destination file */ |
L_UINT uTransform; |
/* the transformation to perform */ |
pLOADFILEOPTION pLoadOptions; |
/* pointer to optional extended load options */ |
Performs a lossless transformation for certain formats. The specified file is the destination file, while the internal file used by the class object is the source file. Currently, only JPEG, CMP and JPEG TIFF formats are supported.
Parameter |
Description |
|
pszFileDst |
Character string containing the name of the destination file. |
|
uTransform |
Binary flags that indicate the transform to be performed. Possible values are: |
|
|
Value |
Meaning |
|
FILE_TRANSFORM_FLIP |
[0x0001] Flip the image. |
|
FILE_TRANSFORM_REVERSE |
[0x0002] Reverse the image. |
|
FILE_TRANSFORM_ROTATE90 |
[0x0004] Rotate the image clockwise by 90 degrees. |
|
FILE_TRANSFORM_ROTATE180 |
[0x0008] Rotate the image clockwise by 180 degrees. |
|
FILE_TRANSFORM_ROTATE270 |
[0x000C] Rotate the image clockwise by 270 degrees. |
pLoadOptions |
Pointer to optional extended load options. Pass NULL to use the default load options. This is useful only for transforming JPEG TIFF files. The load options will specify the page to transform. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Only one of the rotate flags can be specified.
This function calls the LFile:TransformFileCallBack, if the callback function has been enabled by calling the LBase::EnableCallBack. The callback function is provided for processing custom markers. (This is useful for rotating JPEG files only.) When transforming JPEG files, LFile::TransformFile will enumerate all the markers contained in the file and it will pass them to this callback. The user has the ability to control the transformation for all the markers. For additional information on JPEG markers, please consult the JPEG specification.
To customize this callback, derive a new class from LFile and override LFile::TransformFileCallBack, providing the needed functionality. (Create the object from the new class.)
The files transformed by this function will be read transformed by other applications capable of reading these file formats.
For JPEG files, the size of the image might be changed. The image width and height is adjusted to be a multiple of 8 or 16 depending on the subsampling present in the image. If the image is 4:4:4, the width and height is adjusted to be a multiple of 16. If the image is 422, the original width is adjusted to be a multiple of 16 and the height to be a multiple of 8. After rotation, the width might become height. If the image is 411, the width and height are adjusted to be a multiple of 16.
The transformation is lossless. It is better than loading the image, transforming it using LBitmapBase::Rotate, LBitmapBase::Flip or LBitmapBase::Reverse and resaving it. Repeated load and save process will cause image degradation, but calling this function will not cause any image degradation.
The rotation transformations are performed before the flip/reverse operations.
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. |
Win32, x64.
See Also
Functions: |
LFile::LoadFile, LBitmapBase::Rotate, LBitmapBase::Flip, LBitmapBase::Reverse, Class Members |
Topics: |
|
|
Example
L_INT LFile__TransformFileExample(L_TCHAR * pszFileSrc, L_TCHAR * pszFileDst) { L_INT nRet; LFile File; File.SetFileName(pszFileSrc); nRet = File.TransformFile(pszFileDst, FILE_TRANSFORM_ROTATE90); if(nRet != SUCCESS) return nRet; return SUCCESS; }