TIFFWriteDirectory.3tiff 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .\" $Id: TIFFWriteDirectory.3tiff,v 1.3 2010-12-12 01:45:35 faxguy Exp $
  2. .\"
  3. .\" Copyright (c) 1988-1997 Sam Leffler
  4. .\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
  5. .\"
  6. .\" Permission to use, copy, modify, distribute, and sell this software and
  7. .\" its documentation for any purpose is hereby granted without fee, provided
  8. .\" that (i) the above copyright notices and this permission notice appear in
  9. .\" all copies of the software and related documentation, and (ii) the names of
  10. .\" Sam Leffler and Silicon Graphics may not be used in any advertising or
  11. .\" publicity relating to the software without the specific, prior written
  12. .\" permission of Sam Leffler and Silicon Graphics.
  13. .\"
  14. .\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  15. .\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  16. .\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  17. .\"
  18. .\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19. .\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20. .\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. .\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
  22. .\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  23. .\" OF THIS SOFTWARE.
  24. .\"
  25. .if n .po 0
  26. .TH TIFFWriteDirectory 3TIFF "September 26, 2001" "libtiff"
  27. .SH NAME
  28. TIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \- write the
  29. current directory in an open
  30. .SM TIFF
  31. file
  32. .SH SYNOPSIS
  33. .B "#include <tiffio.h>"
  34. .sp
  35. .BI "int TIFFWriteDirectory(TIFF *" tif ")"
  36. .br
  37. .BI "int TIFFRewriteDirectory(TIFF *" tif ")"
  38. .br
  39. .BI "int TIFFCheckpointDirectory(TIFF *" tif ")"
  40. .SH DESCRIPTION
  41. .IR TIFFWriteDirectory
  42. will write the contents of the current directory to the file and setup to
  43. create a new subfile in the same file. Applications only need to call
  44. .IR TIFFWriteDirectory
  45. when writing multiple subfiles to a single
  46. .SM TIFF
  47. file.
  48. .IR TIFFWriteDirectory
  49. is automatically called by
  50. .IR TIFFClose
  51. and
  52. .IR TIFFFlush
  53. to write a modified directory if the file is open for writing.
  54. .PP
  55. The
  56. .IR TIFFRewriteDirectory
  57. function operates similarly to
  58. .IR TIFFWriteDirectory,
  59. but can be called with directories previously read or written that already
  60. have an established location in the file. It will rewrite the directory,
  61. but instead of place it at it's old location (as
  62. .IR TIFFWriteDirectory
  63. would) it will place them at the end of the file, correcting the pointer from
  64. the preceding directory or file header to point to it's new location. This
  65. is particularly important in cases where the size of the directory and
  66. pointed to data has grown, so it won't fit in the space available at the
  67. old location.
  68. .PP
  69. The
  70. .IR TIFFCheckpointDirectory
  71. writes the current state of the tiff directory into the file to make what
  72. is currently in the file readable. Unlike
  73. .IR TIFFWriteDirectory,
  74. .IR TIFFCheckpointDirectory
  75. does not free up the directory data structures in memory, so they can be
  76. updated (as strips/tiles are written) and written again. Reading such
  77. a partial file you will at worst get a tiff read error for the first
  78. strip/tile encountered that is incomplete, but you will at least get
  79. all the valid data in the file before that. When the file is complete,
  80. just use
  81. .IR TIFFWriteDirectory
  82. as usual to finish it off cleanly.
  83. .SH "RETURN VALUES"
  84. 1 is returned when the contents are successfully written to the file.
  85. Otherwise, 0 is returned if an error was encountered when writing
  86. the directory contents.
  87. .SH DIAGNOSTICS
  88. All error messages are directed to the
  89. .IR TIFFError (3TIFF)
  90. routine.
  91. .PP
  92. .BR "Error post-encoding before directory write" .
  93. Before writing the contents of the current directory, any pending data are
  94. flushed. This message indicates that an error occurred while doing this.
  95. .PP
  96. .BR "Error flushing data before directory write" .
  97. Before writing the contents of the current directory, any pending data are
  98. flushed. This message indicates that an error occurred while doing this.
  99. .PP
  100. .BR "Cannot write directory, out of space" .
  101. There was not enough space to allocate a temporary area for the directory that
  102. was to be written.
  103. .PP
  104. .BR "Error writing directory count" .
  105. A write error occurred when writing the count of fields in the directory.
  106. .PP
  107. .BR "Error writing directory contents" .
  108. A write error occurred when writing the directory fields.
  109. .PP
  110. .BR "Error writing directory link" .
  111. A write error occurred when writing the link to the next directory.
  112. .PP
  113. \fBError writing data for field "%s"\fP.
  114. A write error occurred when writing indirect data for the specified field.
  115. .PP
  116. .BR "Error writing TIFF header" .
  117. A write error occurred when re-writing header at the front of the file.
  118. .PP
  119. .BR "Error fetching directory count" .
  120. A read error occurred when fetching the directory count field for
  121. a previous directory.
  122. This can occur when setting up a link to the directory that is being
  123. written.
  124. .PP
  125. .BR "Error fetching directory link" .
  126. A read error occurred when fetching the directory link field for
  127. a previous directory.
  128. This can occur when setting up a link to the directory that is being
  129. written.
  130. .SH "SEE ALSO"
  131. .BR TIFFOpen (3TIFF),
  132. .BR TIFFError (3TIFF),
  133. .BR TIFFReadDirectory (3TIFF),
  134. .BR TIFFSetDirectory (3TIFF),
  135. .BR libtiff (3TIFF)
  136. .PP
  137. Libtiff library home page:
  138. .BR http://www.remotesensing.org/libtiff/