TiffPages¶
- final class tifffile.TiffPages(arg, /, *, index=None)¶
Sequence of TIFF image file directories (IFD chain).
TiffPages instances have a state, such as a cache and keyframe, and are not thread-safe. All attributes are read-only.
- Parameters:
arg (TiffFile | TiffPage | TiffFrame) – If a TiffFile, the file position must be at offset to offset to TiffPage. If a TiffPage or TiffFrame, page offsets are read from the SubIFDs tag. Only the first page is initially read from the file.
index (Sequence[int] | int | None) – Position of IFD chain in IFD tree.
- property is_multipage: bool¶
IFD chain contains more than one page.
- property cache: bool¶
Pages and frames are being cached.
When set to False, the cache is cleared.
- property useframes: bool¶
Use TiffFrame (True) or TiffPage (False).
- set_keyframe(index, /)¶
Set keyframe to TiffPage specified by index.
If not found in the cache, the TiffPage at index is loaded from file and added to the cache.
- Parameters:
index (int)
- Return type:
None
- property next_page_offset: int | None¶
Offset where offset to new page can be stored.
- get(key, /, default=None, *, validate=0, cache=False, aspage=True)¶
Return specified page from cache or file.
The specified TiffPage or TiffFrame is read from file if it is not found in the cache.
- Parameters:
key (int) – Index of requested page in IFD chain.
default (TiffPage | TiffFrame | None) – Page or frame to return if key is out of bounds. By default, an IndexError is raised if key is out of bounds.
validate (int) – If non-zero, raise RuntimeError if value does not match hash of TiffPage or TiffFrame.
cache (bool) – Store returned page in cache for future use.
aspage (bool) – Return TiffPage instance.
- Return type: