Documentation Center

  • Trials
  • Product Updates

getTag

Class: Tiff

Value of specified tag

Syntax

tagValue = getTag(tagId)

Description

tagValue = getTag(tagId) retrieves the value of the TIFF tag specified by tagId. You can specify tagId as a character string ('ImageWidth') or using the numeric tag identifier defined by the TIFF specification (256). To see a list of all the tags with their numeric identifiers, view the value of the Tiff object TagID property. Use the TagID property to specify the value of a tag. For example, Tiff.TagID.ImageWidth is equivalent to the tag's numeric identifier.

Examples

expand all

Get Value of Tag

Open a Tiff object and get the value of a tag. Specify the tag by name.

t = Tiff('example.tif','r');
tagval = t.getTag('ImageWidth')
tagval =

   600

Alternatively, specify the tag by numeric identifier.

tagval1 = t.getTag(256)
tagval1 =

   600

Another way to specify the numeric identifier is to use the TagID property.

tagval2 = t.getTag(Tiff.TagID.ImageWidth)
tagval2 =

   600

Close the Tiff object.

t.close();

References

This method corresponds to the TIFFGetField function in the LibTIFF C API. To use this method, you must be familiar with the TIFF specification and technical notes. View this documentation at LibTiff - TIFF Library and Utilities.

See Also

Was this topic helpful?