LEADTOOLS Raster Imaging C DLL Help > LEADTOOLS Raster Imaging Features > File Processing > File Comments, Markers and Tags > Implementing TIFF Comments and Tags |
The TIFF file formats support a number of comments that are saved and loaded using predefined tags. To specify a comment to be saved, you can use the L_SetComment and L_GetComment functions. To read a comment from an existing file, you can use L_ReadFileComment or L_ReadFileCommentMemory. To read a comment from a file at a specified location, use the L_ReadFileCommentOffset function. To read all comments from an existing file, use L_ReadFileComments. When the data allocated by calling the L_ReadFileComments function are no longer needed it must be freed by calling L_FreeFileComments.
Note: |
If an error occurred in reading all file comments using the L_ReadFileComments function, then no comments will be returned, and the user is responsible to find the valid metadata in the file. |
To write comments to an existing file, use L_WriteFileComment or L_WriteFileCommentExt. To check whether a file format supports comment fields, use L_CommentsSupported. You can use the L_DeleteComment function to delete a comment field from a file. For a list of possible comments, refer to TIFF File Comments.
If the comments do not meet your needs, you can define your own tag for saving additional non-raster data in a TIFF file. For example, you may want to define a tag to save annotations.
The TIFF 6.0 Specification sets aside a range of private tags that developers can define. To avoid conflicts with files created by other developers, you can register your tag by contacting Adobe Developer Relations. (The E-Mail address posted on The Unofficial TIFF Home Page is gapdevsup@adobe.com.)
To define a tag and to specify the data to save in the tag, you can use the L_SetTag and L_GetTag functions. To load the tagged data from a file, you can use L_ReadFileTag or L_ReadFileTagMemory .To read all tags from an existing file, use L_ReadFileTags. When the data allocated by calling the L_ReadFileTags function are no longer needed it must be freed by calling L_FreeFileTags. To write tags to an existing file, or to change existing tags in a file, use L_WriteFileTag. To check whether a file format supports tags, use L_TagsSupported.
Note: |
To write tags to a TIFF file, use L_WriteFileTag or L_WriteFileTagMemory instead of using L_SetTag followed by L_SaveFile or L_SaveFileMemory. |
L_EnumFileTags enumerates all tags in a TIFF or Exif file. For each tag enumerated, the ENUMTAGSCALLBACK function is called. Through this callback function, you can obtain information about, or otherwise process, each tag that is enumerated. You can delete a specified tag from the file using L_DeleteTag.
The LEADTOOLS functions let you save one additional tag in a TIFF file. They are designed for future expansion to more than one tag.