This is machine translation

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


Class: Tiff

Value of specified tag


tagValue = getTag(tagId)


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.


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 =


Alternatively, specify the tag by numeric identifier.

tagval1 = t.getTag(256)
tagval1 =


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

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


Close the Tiff object.


Related Examples


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?