L_WriteFileTag
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_WriteFileTag(pszFile, pSaveOptions)
/* filename */ | |
pSAVEFILEOPTION pSaveOptions; |
/* pointer to optional extended save options */ |
Writes tags to a file or changes existing tags in a file.
Parameter |
Description |
pszFile |
Character string that contains the filename. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. pSaveOptions.PageNumber indicates the page on which to write the tags. Note that an error code will be returned if the page does not exist. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function writes tags into an existing file or changes tags in an existing file.
This function will write all the tags that have been set using L_SetTag. There must be at least one tag set for this function to work. If no tags have been set, an error will be returned by this function.
This function works only with TIFF files.
Note: |
Use this function carefully. LEADTOOLS will not restrict the tags that you write. If you write bad tags, the file might become corrupted. Consult the TIFF documentation for a list of predefined tags. It is recommended that you write only the user-defined tags (the tags between 0x8000 and 0xFFFF). |
|
See the TIFF documentation for a complete list of the TIFF tags and types. |
When you add or remove comments or tags, the comments and tags array at the end of the TIFF/Exif image file is re-written. When you modify existing comments or tags, the new value is added to the file and the IFD is modified as necessary. In all of these cases, there is no image recompression.
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 95 / 98 / Me, Windows 2000 / XP, Windows CE.
See Also
Functions: |
L_SetTag, L_GetTag, SAVEFILEOPTION, L_SaveFile, L_SaveBitmap, L_ReadFileTag, L_WriteFileMetaData, L_DeleteTag |
Topics: |
|
|
Example
void TestSaveTag()
{
L_UINT16 LogoPosition = 0x8001; /* my private tag */
L_UINT16 TagType = TAG_SHORT; /*
tagged data type */
L_UINT32 TagCount = 4; /* count of data items */
L_INT16 TagData[] = {5, 5, 24, 37};
L_VOID L_FAR * pTagData = &TagData; /* pointer to the buffer containing the data */
SAVEFILEOPTION SaveFileOption;
/* Set the tag data to be saved */
L_SetTag(LogoPosition, TagType, TagCount, pTagData);
L_GetDefaultSaveFileOption(&SaveFileOption, sizeof(SAVEFILEOPTION));
SaveFileOption.PageNumber = 1;
/* Save the file with the tag. Note that TEST.TIF must exist and contain at least one page! */
L_WriteFileTag(TEXT("TEST.TIF"), &SaveFileOption);
/* Clear the tag from memory */
L_SetTag(0, 0, 0, NULL);
}