TiffFrame

class tifffile.TiffFrame(parent, /, index, *, offset=None, keyframe=None, dataoffsets=None, databytecounts=None)

Lightweight TIFF image file directory (IFD).

The purpose of TiffFrame is to reduce resource usage and speed up reading image data from file compared to TiffPage. Properties other than offset, index, dataoffsets, databytecounts, subifds, and jpegtables are assumed to be identical with a specified TiffPage instance, the keyframe. TiffFrame instances have no tags property. Virtual frames just reference the image data in the file. They may not have an IFD structure in the file.

TiffFrame instances are not thread-safe. All attributes are read-only.

Parameters:
  • parent (TiffFile) – TiffFile instance to read frame from. The file handle position must be at an offset to an IFD structure. Only a limited number of tag values are read from file.

  • index (int | Sequence[int]) – Index of frame in IFD tree.

  • offset (int) – Position of frame in file.

  • keyframe (TiffPage | None) – TiffPage instance with same hash as frame.

  • dataoffsets (tuple[int, ...]) – Data offsets of “virtual frame”.

  • databytecounts (tuple[int, ...]) – Data bytecounts of “virtual frame”.

asarray(*args, **kwargs)

Return image from frame as NumPy array.

Parameters:
Return type:

NDArray[Any]

aspage()

Return TiffPage from file.

Raise ValueError if frame is virtual.

Return type:

TiffPage

aszarr(**kwargs)

Return image from frame as Zarr 2 store.

Parameters:
Return type:

ZarrTiffStore

property index: int

Index of frame in IFD chain.

property is_frame: bool

Object is TiffFrame instance.

property is_subifd: bool

Frame is SubIFD of another page.

property is_virtual: bool

Frame does not have IFD structure in file.

property keyframe: TiffPage | None

TiffPage with same properties as this frame.

property treeindex: tuple[int, ...]

Index of frame in IFD tree.