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 LFileSettings::SetComment and LFileSettings::GetComment functions. To read a comment from an existing file, you can use LFile::ReadComment or LMemoryFile::ReadComment. To read a comment from a file at a specified location, use the LFile::ReadCommentOffset function. 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 LFileSettings::SetTag and LFileSettings::GetTag functions. To load the tagged data from a file, you can use LFile::ReadTag or LMemoryFile::ReadTag. To write tags to an existing file, or to change existing tags in a file, use LFile::WriteTag.

LFile::EnumTags enumerates all tags in a TIFF or Exif file. For each tag enumerated, the LFile::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 LFile::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.

NOTE: To save a region inside a TIFF file, you must have an unlocked Document, Vector, or Medical Imaging license