Open a TIFF file and get the value of its tags in multiple ways.
Create a Tiff object for the file.
t = Tiff('example.tif','r');
Get the tag value for the ImageWidth tag by specifying the tag by its name.
tagval = getTag(t,'ImageWidth')
tagval =
600
Alternatively, specify the tag by its numeric identifier.
tagval1 = getTag(t,256)
tagval1 =
600
Another way to specify the tag is to use the Tiff.TagID structure. The names of the fields of the Tiff.TagID structure are valid tag names that contain the corresponding tag numeric identifiers. For instance the field Tiff.TagID.ImageWidth contains the value 256.
Tiff object representing a TIFF file. Use the Tiff function to create the object.
Tag ID of a Tiff object, specified as a character vector or string scalar,
or a numeric identifier.
For example, you can specify tagId for the ImageWidth
tag as any of these:
Character vector or string scalar containing the tag name
'ImageWidth'
Numeric identifier 256 for the
ImageWidth tag defined by the TIFF
specification
Field of the Tiff.TagID structure
Tiff.TagID.ImageWidth.
The names of the fields of the Tiff.TagID structure are valid tag
names that contain the corresponding tag numeric identifiers. For instance, the field
Tiff.TagID.ImageWidth contains the value 256.
To see a list of all the tags along with their numeric identifiers, type
Tiff.TagID in the command window.
This function corresponds to the TIFFGetField function in the
LibTIFF C API. To use this function, you must be familiar with the TIFF
specification and technical notes. View this documentation at LibTIFF - TIFF Library and Utilities.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.