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 write comments to an existing file, use L_WriteFileComment or L_WriteFileCommentExt. 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 write tags to an existing file, or to change existing tags in a file, use L_WriteFileTag.

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.