Blame man/TIFFWriteDirectory.3tiff

Packit 7838c8
.\" $Id: TIFFWriteDirectory.3tiff,v 1.4 2016-09-25 20:05:50 bfriesen Exp $
Packit 7838c8
.\"
Packit 7838c8
.\" Copyright (c) 1988-1997 Sam Leffler
Packit 7838c8
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
Packit 7838c8
.\"
Packit 7838c8
.\" Permission to use, copy, modify, distribute, and sell this software and 
Packit 7838c8
.\" its documentation for any purpose is hereby granted without fee, provided
Packit 7838c8
.\" that (i) the above copyright notices and this permission notice appear in
Packit 7838c8
.\" all copies of the software and related documentation, and (ii) the names of
Packit 7838c8
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 7838c8
.\" publicity relating to the software without the specific, prior written
Packit 7838c8
.\" permission of Sam Leffler and Silicon Graphics.
Packit 7838c8
.\" 
Packit 7838c8
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 7838c8
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 7838c8
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 7838c8
.\" 
Packit 7838c8
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 7838c8
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 7838c8
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 7838c8
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 7838c8
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 7838c8
.\" OF THIS SOFTWARE.
Packit 7838c8
.\"
Packit 7838c8
.if n .po 0
Packit 7838c8
.TH TIFFWriteDirectory 3TIFF "September 26, 2001" "libtiff"
Packit 7838c8
.SH NAME
Packit 7838c8
TIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \- write the
Packit 7838c8
current directory in an open
Packit 7838c8
.SM TIFF
Packit 7838c8
file
Packit 7838c8
.SH SYNOPSIS
Packit 7838c8
.B "#include <tiffio.h>"
Packit 7838c8
.sp
Packit 7838c8
.BI "int TIFFWriteDirectory(TIFF *" tif ")"
Packit 7838c8
.br
Packit 7838c8
.BI "int TIFFRewriteDirectory(TIFF *" tif ")"
Packit 7838c8
.br
Packit 7838c8
.BI "int TIFFCheckpointDirectory(TIFF *" tif ")"
Packit 7838c8
.SH DESCRIPTION
Packit 7838c8
.IR TIFFWriteDirectory 
Packit 7838c8
will write the contents of the current directory to the file and setup to
Packit 7838c8
create a new subfile in the same file. Applications only need to call
Packit 7838c8
.IR TIFFWriteDirectory
Packit 7838c8
when writing multiple subfiles to a single
Packit 7838c8
.SM TIFF
Packit 7838c8
file.
Packit 7838c8
.IR TIFFWriteDirectory
Packit 7838c8
is automatically called by
Packit 7838c8
.IR TIFFClose
Packit 7838c8
and
Packit 7838c8
.IR TIFFFlush
Packit 7838c8
to write a modified directory if the file is open for writing.
Packit 7838c8
.PP
Packit 7838c8
The 
Packit 7838c8
.IR TIFFRewriteDirectory
Packit 7838c8
function operates similarly to 
Packit 7838c8
.IR TIFFWriteDirectory,
Packit 7838c8
but can be called with directories previously read or written that already
Packit 7838c8
have an established location in the file.  It will rewrite the directory,
Packit 7838c8
but instead of place it at it's old location (as 
Packit 7838c8
.IR TIFFWriteDirectory
Packit 7838c8
would) it will place them at the end of the file, correcting the pointer from
Packit 7838c8
the preceding directory or file header to point to it's new location.  This
Packit 7838c8
is particularly important in cases where the size of the directory and
Packit 7838c8
pointed to data has grown, so it won't fit in the space available at the
Packit 7838c8
old location.
Packit 7838c8
.PP
Packit 7838c8
The
Packit 7838c8
.IR TIFFCheckpointDirectory
Packit 7838c8
writes the current state of the tiff directory into the file to make what
Packit 7838c8
is currently in the file readable.  Unlike
Packit 7838c8
.IR TIFFWriteDirectory,
Packit 7838c8
.IR TIFFCheckpointDirectory
Packit 7838c8
does not free up the directory data structures in memory, so they can be
Packit 7838c8
updated (as strips/tiles are written) and written again.  Reading such
Packit 7838c8
a partial file you will at worst get a tiff read error for the first
Packit 7838c8
strip/tile encountered that is incomplete, but you will at least get
Packit 7838c8
all the valid data in the file before that.  When the file is complete,
Packit 7838c8
just use
Packit 7838c8
.IR TIFFWriteDirectory
Packit 7838c8
as usual to finish it off cleanly.
Packit 7838c8
.SH "RETURN VALUES"
Packit 7838c8
1 is returned when the contents are successfully written to the file.
Packit 7838c8
Otherwise, 0 is returned if an error was encountered when writing
Packit 7838c8
the directory contents.
Packit 7838c8
.SH DIAGNOSTICS
Packit 7838c8
All error messages are directed to the
Packit 7838c8
.IR TIFFError (3TIFF)
Packit 7838c8
routine.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error post-encoding before directory write" .
Packit 7838c8
Before writing the contents of the current directory, any pending data are
Packit 7838c8
flushed. This message indicates that an error occurred while doing this.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error flushing data before directory write" .
Packit 7838c8
Before writing the contents of the current directory, any pending data are
Packit 7838c8
flushed. This message indicates that an error occurred while doing this.
Packit 7838c8
.PP
Packit 7838c8
.BR "Cannot write directory, out of space" .
Packit 7838c8
There was not enough space to allocate a temporary area for the directory that
Packit 7838c8
was to be written.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error writing directory count" .
Packit 7838c8
A write error occurred when writing the count of fields in the directory.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error writing directory contents" .
Packit 7838c8
A write error occurred when writing the directory fields.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error writing directory link" .
Packit 7838c8
A write error occurred when writing the link to the next directory.
Packit 7838c8
.PP
Packit 7838c8
\fBError writing data for field "%s"\fP.
Packit 7838c8
A write error occurred when writing indirect data for the specified field.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error writing TIFF header" .
Packit 7838c8
A write error occurred when re-writing header at the front of the file.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error fetching directory count" .
Packit 7838c8
A read error occurred when fetching the directory count field for
Packit 7838c8
a previous directory.
Packit 7838c8
This can occur when setting up a link to the directory that is being
Packit 7838c8
written.
Packit 7838c8
.PP
Packit 7838c8
.BR "Error fetching directory link" .
Packit 7838c8
A read error occurred when fetching the directory link field for
Packit 7838c8
a previous directory.
Packit 7838c8
This can occur when setting up a link to the directory that is being
Packit 7838c8
written.
Packit 7838c8
.SH "SEE ALSO"
Packit 7838c8
.BR TIFFOpen (3TIFF),
Packit 7838c8
.BR TIFFError (3TIFF),
Packit 7838c8
.BR TIFFReadDirectory (3TIFF),
Packit 7838c8
.BR TIFFSetDirectory (3TIFF),
Packit 7838c8
.BR libtiff (3TIFF)
Packit 7838c8
.PP
Packit 7838c8
Libtiff library home page:
Packit 7838c8
.BR http://www.simplesystems.org/libtiff/