TIFFSETDIRECTORY(3tiff)
π TIFFSETDIRECTORY β setting the current directory for an open TIFF file π
okay bestie, welcome to the LibTIFF corner of the manual, page TIFFSETDIRECTORY(3tiff). this one is all about telling your open TIFF file which directory you wanna be looking at rn. it's giving file-navigation main character energy ποΈβ¨
π¦ SYNOPSIS π¦
#include <tiffio.h>
int TIFFSetDirectory(TIFF *tif, tdir_t dirnum)
int TIFFSetSubDirectory(TIFF *tif, uint64_t diroff)
πΈ DESCRIPTION πΈ
so like, TIFFSetDirectory() does two things at once and honestly? slay. it changes the current directory and reads its contents with TIFFReadDirectory(). the parameter dirnum tells it which subfile/directory you want, as an integer number β and heads up, the first directory is numbered zero, because of course it is, zero-indexing stays undefeated π
and here's the lil catch: TIFFSetDirectory() only works with main-IFD chains, because it always starts with the first main-IFD, and that's exactly how it's able to reset the SubIFD reading chain back to the main-IFD chain. it's a reset girlie π«Ά
then there's TIFFSetSubDirectory(), which is basically TIFFSetDirectory()'s sibling β same vibe, except the directory is specified as a file offset instead of an index. and you need this one for accessing subdirectories linked through a SubIFD tag. (see MultiPage SubIFD) π₯
now, the directory query functions β TIFFCurrentDirectory(), TIFFCurrentDirOffset(), TIFFLastDirectory() and TIFFNumberOfDirectories() β retrieve information about directories in an open TIFF file. cute, right? but bestie, listen:
β οΈ be aware that until a directory is not written to file AND read back, the query functions won't retrieve the correct information! no cap, that's a real gotcha π
β¨ RETURN VALUES β¨
- on a successful return,
1is returned. periodt π - otherwise,
0is returned ifdirnumordiroffspecifies a non-existent directory, or if an error was encountered while reading the directory's contents. π
π DIAGNOSTICS π
all error messages are directed to the TIFFErrorExtR() routine. she's the one handling all the drama.
"%s: Error fetching directory count"β an error was encountered while reading the"directory count"field. π"%s: Error fetching directory link"β an error was encountered while reading the"link value"that points to the next directory in a file. π
π SEE ALSO π
TIFFquery(3tiff)TIFFOpen(3tiff)TIFFCreateDirectory(3tiff)TIFFCustomDirectory(3tiff)TIFFWriteDirectory(3tiff)TIFFReadDirectory(3tiff)- Multi Page / Multi Image TIFF
libtiff(3tiff)
π AUTHOR π
LibTIFF contributors β icons only, fr fr π«Ά
π COPYRIGHT π
1988-2025, LibTIFF contributors
okay that's the whole page, bestie, you ate that πβ¨ this was page TIFFSETDIRECTORY(3tiff) from LibTIFF version 4.7, dated Jun 27, 2026. go set some directories, you've got this π
π
mwah π
π¦ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms