| 1 |
TIFFquery |
| 2 |
========= |
| 3 |
|
| 4 |
Synopsis |
| 5 |
-------- |
| 6 |
|
| 7 |
.. highlight:: c |
| 8 |
|
| 9 |
:: |
| 10 |
|
| 11 |
#include <tiffio.h> |
| 12 |
|
| 13 |
.. c:function:: tdir_t TIFFCurrentDirectory(TIFF* tif) |
| 14 |
|
| 15 |
.. c:function:: uint64_t TIFFCurrentDirOffset(TIFF* tif) |
| 16 |
|
| 17 |
.. c:function:: int TIFFLastDirectory(TIFF* tif) |
| 18 |
|
| 19 |
.. c:function:: tdir_t TIFFNumberOfDirectories(TIFF* tif) |
| 20 |
|
| 21 |
.. c:function:: uint32_t TIFFCurrentRow(TIFF* tif) |
| 22 |
|
| 23 |
.. c:function:: tstrip_t TIFFCurrentStrip(TIFF* tif) |
| 24 |
|
| 25 |
.. c:function:: ttile_t TIFFCurrentTile(TIFF* tif) |
| 26 |
|
| 27 |
.. c:function:: int TIFFFileno(TIFF* tif) |
| 28 |
|
| 29 |
.. c:function:: char* TIFFFileName(TIFF* tif) |
| 30 |
|
| 31 |
.. c:function:: int TIFFGetMode(TIFF* tif) |
| 32 |
|
| 33 |
.. c:function:: int TIFFIsTiled(TIFF* tif) |
| 34 |
|
| 35 |
.. c:function:: int TIFFIsBigEndian(TIFF* tif) |
| 36 |
|
| 37 |
.. c:function:: int TIFFIsBigTIFF(TIFF* tif) |
| 38 |
|
| 39 |
.. c:function:: int TIFFIsByteSwapped(TIFF* tif) |
| 40 |
|
| 41 |
.. c:function:: int TIFFIsMSB2LSB(TIFF* tif) |
| 42 |
|
| 43 |
.. c:function:: int TIFFIsUpSampled(TIFF* tif) |
| 44 |
|
| 45 |
.. c:function:: const char* TIFFGetVersion(void) |
| 46 |
|
| 47 |
Description |
| 48 |
----------- |
| 49 |
|
| 50 |
The following query routines return status information about the directory |
| 51 |
structure of an open TIFF file. |
| 52 |
|
| 53 |
:c:func:`TIFFCurrentDirectory` returns the index of the current |
| 54 |
:ref:`Image File Directory (IFD) <ImageFileDirectory>`. |
| 55 |
Directories are numbered starting at 0. This number is suitable for |
| 56 |
use with the :c:func:`TIFFSetDirectory` routine. |
| 57 |
There are :ref:`IFDs <ImageFileDirectory>` in the file and an "active" |
| 58 |
:ref:`IFD <ImageFileDirectory>` in memory, from which fields |
| 59 |
are "set" and "get". The index of the current directory returned is: |
| 60 |
|
| 61 |
a) 65535 (non-existing directory) if there is no IFD in the file after opening, |
| 62 |
or the state is unknown, |
| 63 |
or the last read (i.e. TIFFFetchDirectory()) failed, |
| 64 |
or a custom directory was written. |
| 65 |
b) IFD index of last IFD written in the file. |
| 66 |
In this case the active IFD is a new (empty) one and the current directory offset |
| 67 |
from TIFFCurrentDirOffset() is zero. |
| 68 |
If writing fails, the IFD index is not changed. |
| 69 |
c) IFD index of IFD read from file into memory (=active IFD), |
| 70 |
even if IFD is corrupt and TIFFReadDirectory() returns 0. |
| 71 |
Then the current directory offset is the offset of the IFD in the file. |
| 72 |
d) IFD index „0“, whenever a custom directory or an unchained SubIFD |
| 73 |
was read. |
| 74 |
|
| 75 |
:c:func:`TIFFCurrentDirOffset` returns the file offset of the current |
| 76 |
directory (instead of an index). |
| 77 |
The file offset is suitable for use with the :c:func:`TIFFSetSubDirectory` |
| 78 |
routine. This is required for accessing subdirectories linked through a |
| 79 |
``SubIFD`` tag. See also :ref:`SubIFD access <SubIFDAccess>`. |
| 80 |
|
| 81 |
:c:func:`TIFFLastDirectory` returns a non-zero value if the current |
| 82 |
directory is the last directory in the file; otherwise zero is returned. |
| 83 |
A new (empty) directory in the memory (after :c:func:`TIFFWriteDirectory` |
| 84 |
or :c:func:`TIFFCreateDirectory`) |
| 85 |
also counts as the last directory, even if it has not yet been written to a file. |
| 86 |
|
| 87 |
:c:func:`TIFFNumberOfDirectories` returns the number of directories in a |
| 88 |
file. Be aware that just created directories, which are not "written" to |
| 89 |
file do not count. |
| 90 |
|
| 91 |
.. note:: Be aware that the return value of the above directory query functions |
| 92 |
is not valid until the directory is "written" to file AND read back |
| 93 |
e.g. :c:func:`TIFFSetDirectory` or :c:func:`TIFFReadDirectory`. |
| 94 |
|
| 95 |
The following query routines return information about an open TIFF file |
| 96 |
and its image data. |
| 97 |
|
| 98 |
:c:func:`TIFFCurrentRow`, :c:func:`TIFFCurrentStrip`, and |
| 99 |
:c:func:`TIFFCurrentTile` return the current row, strip, and tile, |
| 100 |
respectively, that is being read or written. These values are updated each |
| 101 |
time a read or write is done. |
| 102 |
|
| 103 |
:c:func:`TIFFFileno` returns the underlying file descriptor used to access |
| 104 |
the TIFF image in the filesystem. |
| 105 |
|
| 106 |
:c:func:`TIFFFileName` returns the pathname argument passed to |
| 107 |
:c:func:`TIFFOpen` or :c:func:`TIFFFdOpen`. |
| 108 |
|
| 109 |
:c:func:`TIFFGetMode` returns the mode with which the underlying file |
| 110 |
was opened. On UNIX systems, this is the value passed to the |
| 111 |
:c:func:`open` (2) system call. |
| 112 |
|
| 113 |
:c:func:`TIFFIsTiled` returns a non-zero value if the image data has a tiled |
| 114 |
organization. Zero is returned if the image data is organized in strips. |
| 115 |
|
| 116 |
:c:func:`TIFFIsBigEndian` returns a non-zero value if the file is BigEndian |
| 117 |
and zero if the file is LittleEndian. |
| 118 |
|
| 119 |
:c:func:`TIFFIsBigTIFF` returns a non-zero value if the file is in |
| 120 |
BigTIFF style. |
| 121 |
|
| 122 |
|
| 123 |
:c:func:`TIFFIsByteSwapped` returns a non-zero value if the image data |
| 124 |
was in a different byte-order than the host machine. Zero is returned if |
| 125 |
the TIFF file and local host byte-orders are the same. Note that |
| 126 |
:c:func:`TIFFReadTile`, :c:func:`TIFFReadEncodedStrip` and |
| 127 |
:c:func:`TIFFReadScanline` functions already normally perform byte |
| 128 |
swapping to local host order if needed. |
| 129 |
|
| 130 |
:c:func:`TIFFIsMSB2LSB` returns a non-zero value if the image data is being |
| 131 |
returned with bit 0 as the most significant bit. |
| 132 |
|
| 133 |
:c:func:`TIFFIsUpSampled` returns a non-zero value if image data returned |
| 134 |
through the read interface routines is being up-sampled. This can be |
| 135 |
useful to applications that want to calculate I/O buffer sizes to reflect |
| 136 |
this usage (though the usual strip and tile size routines already do this). |
| 137 |
|
| 138 |
:c:func:`TIFFGetVersion` returns an ``ASCII`` string that has a version |
| 139 |
stamp for the TIFF library software. |
| 140 |
|
| 141 |
Diagnostics |
| 142 |
----------- |
| 143 |
|
| 144 |
None. |
| 145 |
|
| 146 |
See also |
| 147 |
-------- |
| 148 |
|
| 149 |
:doc:`libtiff` (3tiff), |
| 150 |
:doc:`TIFFOpen` (3tiff) |