Tiff.close
Closes the TIFF file held by a Tiff object.
Category: Data Import and Analysis > Data Import and Export
Syntax
close(t)
Closes the file. The form t.close() is equivalent.
Description
The method acts on a Tiff object created with Tiff(filename, mode). Always close a Tiff object that was opened for writing: directories are only completed in the file when it is closed, and the file cannot be reopened reliably before that.
Input arguments
tTiffobject returned by theTiffconstructor.
Example
Write a file and close it
tag.ImageLength = 8; tag.ImageWidth = 8;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1; tag.RowsPerStrip = 4;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
I = uint8(magic(8) * 3);
w = Tiff('t.tif', 'w'); w.setTag(tag); w.write(I); w.close();
r = Tiff('t.tif', 'r');
size(r.read())
r.close();
Output
ans = 1×2
8 8