Blame man/TIFFWriteDirectory.3tiff

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