.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "TIFFSETDIRECTORY" "3tiff" "Nov 23, 2023" "4.5" "LibTIFF" .SH NAME TIFFSetDirectory \- set the current directory for an open TIFF file .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C #include .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B int TIFFSetDirectory(TIFF *tif, tdir_t dirnum) .UNINDENT .INDENT 0.0 .TP .B int TIFFSetSubDirectory(TIFF *tif, uint64_t diroff) .UNINDENT .SH DESCRIPTION .sp \fI\%TIFFSetDirectory()\fP changes the current directory and reads its contents with \fI\%TIFFReadDirectory()\fP\&. The parameter \fIdirnum\fP specifies the subfile/directory as an integer number, with the first directory numbered zero. .sp \fI\%TIFFSetSubDirectory()\fP acts like \fI\%TIFFSetDirectory()\fP, except the directory is specified as a file offset instead of an index; this is required for accessing subdirectories linked through a \fBSubIFD\fP tag. .sp In the case of several SubIFDs of a main image, there are two possibilities that are not even mutually exclusive. .INDENT 0.0 .IP a. 3 The \fBSubIFD\fP tag contains an array with all offsets of the SubIFDs. .IP b. 3 The \fBSubIFDs\fP are concatenated with their \fBNextIFD\fP parameters to a SubIFD chain. .UNINDENT .sp LibTiff does support SubIFD chains partially. When a \fBSubIFD\fP tag is activated with \fI\%TIFFSetSubDirectory()\fP, \fI\%TIFFReadDirectory()\fP is able to parse through the SubIFD chain. The \fItif_curdir\fP is just incremented from its current value and thus gets arbitrary values when parsing through SubIFD chains. \fI\%TIFFSetDirectory()\fP only works with main\-IFD chains because allways starts with the first main\-IFD and thus is able to reset the SubIFD reading chain to the main\-IFD chain. .sp Directory query functions \fI\%TIFFCurrentDirectory()\fP, \fI\%TIFFCurrentDirOffset()\fP, \fI\%TIFFLastDirectory()\fP and \fI\%TIFFNumberOfDirectories()\fP retrieve information about directories in an open TIFF file. Be aware that until a directory is not written to file AND read back, the query functions won\(aqt retrieve the correct information! .SH RETURN VALUES .sp On successful return 1 is returned. Otherwise, 0 is returned if \fIdirnum\fP or \fIdiroff\fP specifies a non\-existent directory, or if an error was encountered while reading the directory\(aqs contents. .SH DIAGNOSTICS .sp All error messages are directed to the \fI\%TIFFErrorExtR()\fP routine. .sp \fB\(dq%s: Error fetching directory count\(dq\fP: .INDENT 0.0 .INDENT 3.5 An error was encountered while reading the \(dqdirectory count\(dq field. .UNINDENT .UNINDENT .sp \fB\(dq%s: Error fetching directory link\(dq\fP: .INDENT 0.0 .INDENT 3.5 An error was encountered while reading the \(dqlink value\(dq that points to the next directory in a file. .UNINDENT .UNINDENT .SH SEE ALSO .sp \fI\%TIFFquery\fP (3tiff), \fI\%TIFFOpen\fP (3tiff), \fI\%TIFFCreateDirectory\fP (3tiff), \fI\%TIFFCustomDirectory\fP (3tiff), \fI\%TIFFWriteDirectory\fP (3tiff), \fI\%TIFFReadDirectory\fP (3tiff), \fI\%libtiff\fP (3tiff) .SH AUTHOR LibTIFF contributors .SH COPYRIGHT 1988-2023, LibTIFF contributors .\" Generated by docutils manpage writer. .