Skip to content

TIFF

async_tiff.TIFF

endianness property

endianness: Endianness

The endianness of this TIFF file.

header_byte_size property

header_byte_size: int

Minimum prefetch size that covers all metadata.

Pass this value as prefetch on a future TIFF.open call to complete metadata reading in a single request.

This is computed as the minimum non-zero offset across every IFD's TileOffsets and StripOffsets.

ifds property

Access the underlying IFDs of this TIFF.

Each ImageFileDirectory (IFD) represents one of the internal "sub images" of this file.

fetch_tile async

fetch_tile(x: int, y: int, z: int) -> Tile

Fetch a single tile.

Parameters:

  • x (int) –

    The column index within the ifd to read from.

  • y (int) –

    The row index within the ifd to read from.

  • z (int) –

    The IFD index to read from.

Returns:

  • Tile

    Tile response.

fetch_tiles async

fetch_tiles(xy: Sequence[tuple[int, int]], z: int) -> list[Tile]

Fetch multiple tiles concurrently.

Parameters:

  • xy (Sequence[tuple[int, int]]) –

    The (column, row) indexes within the ifd to read from.

  • z (int) –

    The IFD index to read from.

Returns:

ifd

ifd(index: int) -> ImageFileDirectory

Access a specific IFD by index.

Parameters:

  • index (int) –

    The IFD index to access.

Returns:

open async classmethod

open(
    path: str,
    *,
    store: ObjectStore | ObspecInput,
    prefetch: int = 32768,
    multiplier: int | float = 2.0,
) -> TIFF

Open a new TIFF.

Parameters:

  • path (str) –

    The path within the store to read from.

  • store (ObjectStore | ObspecInput) –

    The backend to use for data fetching.

  • prefetch (int, default: 32768 ) –

    The number of initial bytes to read up front.

  • multiplier (int | float, default: 2.0 ) –

    The multiplier to use for readahead size growth. Must be greater than 1.0. For example, for a value of 2.0, the first metadata read will be of size prefetch, and then the next read will be of size prefetch * 2.

Returns:

  • TIFF

    A TIFF instance.

async_tiff.ObspecInput

Bases: GetRangeAsync, GetRangesAsync, Protocol

Supported obspec input to reader.

Anything that implements GetRangeAsync and GetRangesAsync can be used as an input to the TIFF reader.