getTag
Value of specified tag
Description
Examples
Get Tag Value
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
.
tagval2 = getTag(t,Tiff.TagID.ImageWidth)
tagval2 = 600
Close the Tiff
object.
close(t);
Input Arguments
t
— Tiff object
Tiff
object
Tiff
object representing a TIFF file. Use the Tiff
function to create the object.
tagID
— Tag ID
character vector | string scalar | numeric identifier
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 theImageWidth
tag defined by the TIFF specificationField of the
Tiff.TagID
structureTiff.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.
Example: 'ImageWidth'
Example: 256
Example: Tiff.TagID.ImageWidth
Data Types: double
| char
| string
Algorithms
References
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.
Version History
Introduced in R2009b
MATLAB Command
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: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)