setDirectory
Make specified IFD the current IFD
Syntax
Description
Examples
Navigate Through Multiple Images in TIFF File
Navigate the image file directories (IFDs) in a TIFF file and get tag or image data from the different IFDs.
Create a Tiff
object for the file example.tif
which contains three IFDs and display the directory index number for the current IFD in the file.
t = Tiff('example.tif','r'); currentDirectory(t)
ans = 1
Change the current IFD to 2
and get the value of the ImageDescription
tag.
setDirectory(t,2);
getTag(t,'ImageDescription')
ans = 'First image converted to grayscale.'
Change the current IFD to 3
and get the value of the ImageDescription
tag.
setDirectory(t,3);
getTag(t,'ImageDescription')
ans = 'Credit: Jeff Mather and Alex Taylor.'
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.
dirNum
— Directory index number
positive integer
Directory index number, specified as a one-based positive integer.
Example: 2
Data Types: double
Algorithms
References
This function corresponds to the TIFFSetDirectory
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
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)