Debian Codegraph @

texk/xdvipsk/thirdparty/libtiff/doc/functions/TIFFReadDirectory.rst

raw
1 TIFFReadDirectory
2 =================
3
4 Synopsis
5 --------
6
7 .. highlight:: c
8
9 ::
10
11 #include <tiffio.h>
12
13 .. c:function:: int TIFFReadDirectory(TIFF* tif)
14
15 Description
16 -----------
17
18 Read the next directory in the specified file and make it the current
19 directory. Applications only need to call :c:func:`TIFFReadDirectory`
20 to read multiple subfiles in a single TIFF file—(the first directory
21 in a file is automatically read when :c:func:`TIFFOpen` is called.
22
23 Notes
24 -----
25
26 If the library is compiled with :c:macro:`STRIPCHOP_SUPPORT` enabled, then
27 images that have a single uncompressed strip or tile of data are
28 automatically treated as if they were made up of multiple strips or tiles of
29 approximately 8 kilobytes each. This operation is done only in-memory; it does
30 not alter the contents of the file. However, the construction of the "chopped
31 strips" is visible to the application through the number of strips [tiles]
32 returned by :c:func:`TIFFNumberOfStrips` [:c:func:`TIFFNumberOfTiles`].
33
34 Return values
35 -------------
36
37 If the next directory was successfully read, 1 is returned. Otherwise, 0 is
38 returned if an error was encountered, or if there are no more directories to
39 be read.
40
41 Diagnostics
42 -----------
43
44 All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
45 Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine.
46
47 ``Seek error accessing TIFF directory``:
48
49 An error occurred while positioning to the location of the
50 directory.
51
52 ``Wrong data type %d for field "%s"``:
53
54 The tag entry in the directory had an incorrect data type.
55 For example, an ``ImageDescription`` tag with a ``SHORT``
56 data type.
57
58 ``TIFF directory is missing required "%s" field``:
59
60 The specified tag is required to be present by the TIFF
61 5.0 specification, but is missing.
62 The directory is (usually) unusable.
63
64 ``%s: Rational with zero denominator``:
65
66 A directory tag has a ``RATIONAL`` value whose denominator is zero.
67
68 ``Incorrect count %d for field "%s" (%lu, expecting %lu); tag ignored``:
69
70 The specified tag's count field is bad.
71 For example, a count other than 1 for a ``SubFileType`` tag.
72
73 ``Cannot handle different per-sample values for field "%s"``:
74
75 The tag has ``SamplesPerPixel`` values and they are not all the same; e.g.
76 ``BitsPerSample``. The library is unable to handle images of this sort.
77
78 ``Count mismatch for field "%s"; expecting %d, got %d``:
79
80 The count field in a tag does not agree with the number expected by the
81 library. This should never happen, so if it does, the library refuses to
82 read the directory.
83
84 ``Invalid TIFF directory; tags are not sorted in ascending order``:
85
86 The directory tags are not properly sorted as specified
87 in the TIFF 5.0 specification. This error is not fatal.
88
89 ``Ignoring unknown field with tag %d (0x%x)``:
90
91 An unknown tag was encountered in the directory;
92 the library ignores all such tags.
93
94 ``TIFF directory is missing required "ImageLength" field``:
95
96 The image violates the specification by not having a necessary field.
97 There is no way for the library to recover from this error.
98
99 ``TIFF directory is missing required "PlanarConfig" field``:
100
101 The image violates the specification by not having a necessary field.
102 There is no way for the library to recover from this error.
103
104 ``TIFF directory is missing required "StripOffsets" field``:
105
106 The image has multiple strips, but is missing the tag that
107 specifies the file offset to each strip of data.
108 There is no way for the library to recover from this error.
109
110 ``TIFF directory is missing required "TileOffsets" field``:
111
112 The image has multiple tiles, but is missing the tag that
113 specifies the file offset to each tile of data.
114 There is no way for the library to recover from this error.
115
116 ``TIFF directory is missing required "StripByteCounts" field``:
117
118 The image has multiple strips, but is missing the tag that
119 specifies the size of each strip of data.
120 There is no way for the library to recover from this error.
121
122 ``TIFF directory is missing required "StripByteCounts" field, calculating from imagelength``:
123
124 The image violates the specification by not having a necessary field.
125 However, when the image is comprised of only one strip or tile, the
126 library will estimate the missing value based on the file size.
127
128 ``Bogus "StripByteCounts" field, ignoring and calculating from imagelength``:
129
130 Certain vendors violate the specification by writing zero for
131 the StripByteCounts tag when they want to leave the value
132 unspecified.
133 If the image has a single strip, the library will estimate
134 the missing value based on the file size.
135
136 See also
137 --------
138
139 :doc:`TIFFOpen` (3tiff),
140 :doc:`TIFFCreateDirectory` (3tiff),
141 :doc:`TIFFCustomDirectory` (3tiff),
142 :doc:`TIFFquery` (3tiff),
143 :doc:`TIFFWriteDirectory` (3tiff),
144 :doc:`TIFFSetDirectory` (3tiff),
145 :doc:`/multi_page`,
146 :doc:`libtiff` (3tiff)