TIFFquery¶
Synopsis¶
#include <tiffio.h>
-
tdir_t TIFFCurrentDirectory(TIFF *tif)¶
-
uint64_t TIFFCurrentDirOffset(TIFF *tif)¶
-
int TIFFLastDirectory(TIFF *tif)¶
-
tdir_t TIFFNumberOfDirectories(TIFF *tif)¶
-
uint32_t TIFFCurrentRow(TIFF *tif)¶
-
tstrip_t TIFFCurrentStrip(TIFF *tif)¶
-
ttile_t TIFFCurrentTile(TIFF *tif)¶
-
int TIFFFileno(TIFF *tif)¶
-
char *TIFFFileName(TIFF *tif)¶
-
int TIFFGetMode(TIFF *tif)¶
-
int TIFFIsTiled(TIFF *tif)¶
-
int TIFFIsBigEndian(TIFF *tif)¶
-
int TIFFIsBigTIFF(TIFF *tif)¶
-
int TIFFIsByteSwapped(TIFF *tif)¶
-
int TIFFIsMSB2LSB(TIFF *tif)¶
-
int TIFFIsUpSampled(TIFF *tif)¶
-
const char *TIFFGetVersion(void)¶
Description¶
The following query routines return status information about the directory structure of an open TIFF file.
TIFFCurrentDirectory()
returns the index of the current
Image File Directory (IFD).
Directories are numbered starting at 0. This number is suitable for
use with the TIFFSetDirectory()
routine.
There are IFDs in the file and an "active"
IFD in memory, from which fields
are "set" and "get". The index of the current directory returned is:
65535 (non-existing directory) if there is no IFD in the file after opening, or the state is unknown, or the last read (i.e. TIFFFetchDirectory()) failed, or a custom directory was written.
IFD index of last IFD written in the file. In this case the active IFD is a new (empty) one and the current directory offset from TIFFCurrentDirOffset() is zero. If writing fails, the IFD index is not changed.
IFD index of IFD read from file into memory (=active IFD), even if IFD is corrupt and TIFFReadDirectory() returns 0. Then the current directory offset is the offset of the IFD in the file.
IFD index „0“, whenever a custom directory or an unchained SubIFD was read.
TIFFCurrentDirOffset()
returns the file offset of the current
directory (instead of an index).
The file offset is suitable for use with the TIFFSetSubDirectory()
routine. This is required for accessing subdirectories linked through a
SubIFD
tag. See also SubIFD access.
TIFFLastDirectory()
returns a non-zero value if the current
directory is the last directory in the file; otherwise zero is returned.
A new (empty) directory in the memory (after TIFFWriteDirectory()
or TIFFCreateDirectory()
)
also counts as the last directory, even if it has not yet been written to a file.
TIFFNumberOfDirectories()
returns the number of directories in a
file. Be aware that just created directories, which are not "written" to
file do not count.
Note
Be aware that the return value of the above directory query functions
is not valid until the directory is "written" to file AND read back
e.g. TIFFSetDirectory()
or TIFFReadDirectory()
.
The following query routines return information about an open TIFF file and its image data.
TIFFCurrentRow()
, TIFFCurrentStrip()
, and
TIFFCurrentTile()
return the current row, strip, and tile,
respectively, that is being read or written. These values are updated each
time a read or write is done.
TIFFFileno()
returns the underlying file descriptor used to access
the TIFF image in the filesystem.
TIFFFileName()
returns the pathname argument passed to
TIFFOpen()
or TIFFFdOpen()
.
TIFFGetMode()
returns the mode with which the underlying file
was opened. On UNIX systems, this is the value passed to the
open()
(2) system call.
TIFFIsTiled()
returns a non-zero value if the image data has a tiled
organization. Zero is returned if the image data is organized in strips.
TIFFIsBigEndian()
returns a non-zero value if the file is BigEndian
and zero if the file is LittleEndian.
TIFFIsBigTIFF()
returns a non-zero value if the file is in
BigTIFF style.
TIFFIsByteSwapped()
returns a non-zero value if the image data
was in a different byte-order than the host machine. Zero is returned if
the TIFF file and local host byte-orders are the same. Note that
TIFFReadTile()
, TIFFReadEncodedStrip()
and
TIFFReadScanline()
functions already normally perform byte
swapping to local host order if needed.
TIFFIsMSB2LSB()
returns a non-zero value if the image data is being
returned with bit 0 as the most significant bit.
TIFFIsUpSampled()
returns a non-zero value if image data returned
through the read interface routines is being up-sampled. This can be
useful to applications that want to calculate I/O buffer sizes to reflect
this usage (though the usual strip and tile size routines already do this).
TIFFGetVersion()
returns an ASCII
string that has a version
stamp for the TIFF library software.
Diagnostics¶
None.