Skip to content

TileIterator

pixeltable.iterators.TileIterator

TileIterator(
    image: Image,
    *,
    tile_size: tuple[int, int],
    overlap: tuple[int, int] = (0, 0)
)

Iterator over tiles of an image. Each image will be divided into tiles of size tile_size, and the tiles will be iterated over in row-major order (left-to-right, then top-to-bottom). An optional overlap parameter may be specified. If the tiles do not exactly cover the image, then the rightmost and bottommost tiles will be padded with blackspace, so that the output images all have the exact size tile_size.

Parameters:

  • image (Image) –

    Image to split into tiles.

  • tile_size (tuple[int, int]) –

    Size of each tile, as a pair of integers [width, height].

  • overlap (tuple[int, int], default: (0, 0) ) –

    Amount of overlap between adjacent tiles, as a pair of integers [width, height].