TiffFrame

final 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”.

parent: TiffFile

TiffFile instance frame belongs to.

offset: int

Position of frame in file.

dataoffsets: tuple[int, ...]

Positions of strips or tiles in file.

databytecounts: tuple[int, ...]

Size of strips or tiles in file.

subifds: tuple[int, ...] | None

Positions of SubIFDs in file.

jpegtables: bytes | None

JPEG quantization and/or Huffman tables.

aspage()

Return TiffPage from file.

Raise ValueError if frame is virtual.

Return type:

TiffPage

asarray(*args, **kwargs)

Return image from frame as NumPy array.

Parameters:
Return type:

NDArray[Any]

aszarr(**kwargs)

Return image from frame as Zarr store.

Parameters:
Return type:

ZarrTiffStore

property index: int

Index of frame in IFD chain.

property treeindex: tuple[int, ...]

Index of frame in IFD tree.

property keyframe: TiffPage | None

TiffPage with same properties as this frame.

property is_frame: bool

Object is TiffFrame instance.

property is_virtual: bool

Frame does not have IFD structure in file.

property is_subifd: bool

Frame is SubIFD of another page.