Image.Tile#
- classmethod Image.Tile(tiles: list[Any] | tuple[Any, ...], columns: int = 0, sep: int = 2, bgcolor: Any = None) Self[source]#
Tile images into a grid
- Parameters:
tiles (iterable of
Image) – images to tilecolumns (int, optional) – number of columns in the grid, defaults to 0 (square grid)
sep (int, optional) – separation between images, defaults to 1 pixel
bgcolor (scalar, string, array_like, optional) – color of background, seen in the separation between images, defaults to black
- Raises:
ValueError – all images must have the same size
ValueError – all images must have the same dtype
- Returns:
grid of images
- Return type:
Imageinstance
Construct a new image by tiling the input images into a grid. The images are added to the grid in row-major order. The images are pasted into a background which is set to the color
bgcolor. The last row of the grid may be incomplete and those tile positions will be background color.If
columnsis zero, the tiles are placed in an approximately square grid where the number of rows is greater than or equal to the number of columns. For example, 4 tiles would be placed into a 2x2 grid (width x height), 5 tiles in a 2x3 grid, etc.Example:
>>> from machinevisiontoolbox import Image, FileCollection >>> images = FileCollection('campus/*.png') # image iterator >>> Image.Tile(images) Image(size=(2566, 2138), dtype=uint8, nplanes=3, colororder=R:G:B)
(
Source code,png,hires.png,pdf)
Note
All tiles must have the same size, datatype and colororder.