%% Add IFD to TIFF File
% Create a new TIFF file and add two new IFDs to the file.
% Create a Tiff object for a new file.

t = Tiff('myfile.tif','w');

% Add a new IFD to the file and display the current directory number. You can use this new IFD to add image data and tags to the TIFF file.

writeDirectory(t);
currentDirectory(t)

% Add another IFD to the file and display the current directory number. You can use this IFD to save an additional image to the same TIFF file.

writeDirectory(t);
currentDirectory(t)

% Close the Tiff object.

close(t);

% Copyright 2012 The MathWorks, Inc.