Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getTag

Class: Tiff

Value of specified tag

Syntax

tagValue = getTag(tiffobj,tagId)

Description

tagValue = getTag(tiffobj,tagId) retrieves the value of the TIFF tag specified by tagId from the TIFF file associated with the Tiff object, tiffobj. 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

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.

Was this topic helpful?