table of contents
- bookworm 4.5.0-6+deb12u1
- testing 4.5.1+git230720-5
- unstable 4.5.1+git230720-5
- experimental 4.6.0-2
TIFFWRITEDIRECTORY(3tiff) | LibTIFF | TIFFWRITEDIRECTORY(3tiff) |
NAME¶
TIFFWriteDirectory - write the current directory in an open TIFF file
SYNOPSIS¶
#include <tiffio.h>
DESCRIPTION¶
TIFFWriteDirectory() will write the contents of the current directory (IFD) to the file and setup to create a new directory (IFD) using TIFFCreateDirectory(). Applications only need to call TIFFWriteDirectory() when writing multiple subfiles (images) to a single TIFF file. This is called "multi-page TIFF" or "multi-image TIFF" (see Multi Page / Multi Image TIFF). TIFFWriteDirectory() is automatically called by TIFFClose() and TIFFFlush() to write a modified directory if the file is open for writing.
The TIFFRewriteDirectory() function operates similarly to TIFFWriteDirectory(), but can be called with directories previously read or written that already have an established location in the file. It will rewrite the directory, but instead of placing it at its old location (as TIFFWriteDirectory() would) it will place them at the end of the file, correcting the pointer from the preceding directory or file header to point to it's new location. This is particularly important in cases where the size of the directory and pointed to data has grown, so it won't fit in the space available at the old location.
The TIFFCheckpointDirectory() writes the current state of the tiff directory into the file to make what is currently in the file readable. Unlike TIFFWriteDirectory(), TIFFCheckpointDirectory() does not free up the directory data structures in memory, so they can be updated (as strips/tiles are written) and written again. Reading such a partial file you will at worst get a tiff read error for the first strip/tile encountered that is incomplete, but you will at least get all the valid data in the file before that. When the file is complete, just use TIFFWriteDirectory() as usual to finish it off cleanly.
The TIFFSetWriteOffset() sets the current write offset. This should only be used to set the offset to a known previous location (very carefully), or to 0 so that the next write gets appended to the end of the file.
The TIFFWriteCheck() verify file is writable and that the directory information is setup properly. In doing the latter we also "freeze" the state of the directory so that important information is not changed.
RETURN VALUES¶
1 is returned when the contents are successfully written to the file. Otherwise, 0 is returned if an error was encountered when writing the directory contents.
DIAGNOSTICS¶
All error messages are directed to the TIFFErrorExtR() routine.
"Error post-encoding before directory write":
"Error flushing data before directory write":
"Cannot write directory, out of space":
"Error writing directory count":
"Error writing directory contents":
"Error writing directory link":
Error writing data for field "%s":
"Error writing TIFF header":
"Error fetching directory count":
"Error fetching directory link":
SEE ALSO¶
TIFFquery (3tiff), TIFFOpen (3tiff), TIFFCreateDirectory (3tiff), TIFFCustomDirectory (3tiff), TIFFSetDirectory (3tiff), TIFFReadDirectory (3tiff), TIFFError (3tiff), Multi Page / Multi Image TIFF, libtiff (3tiff)
AUTHOR¶
LibTIFF contributors
COPYRIGHT¶
1988-2023, LibTIFF contributors
November 26, 2023 | 4.6 |