movis.ops.tile#
- movis.ops.tile(layers: Sequence[BasicLayer], rows: int, cols: int, size: tuple[int, int] | None = None) Composition[source]#
Tile layers into a single composition.
- Args:
- layers:
Layers to tile. Note that the order of the layers is row-major. For example, if
layersis[a, b, c, d]androwsandcolsare both2, the composition will be:[[a, b], [c, d]].- rows:
Number of rows.
- cols:
Number of columns.
- size:
Size of each layer. Note that
tileassumes that all layers have the same size. IfNone, the size of the layer is estimated.
Note
The layer resolution specified in
sizedoes not have to be the actual layer resolution. For example, ifsizeis specified to be larger than the actual layer size, each layer is placed in the center of each tile.- Returns:
Composition with all layers tiled. The size is
(cols * w, rows * h), wherewandhare the width and height of each layer, respectively.- Examples:
>>> import movis as mv >>> import numpy as np >>> layer1 = mv.layer.Image(np.zeros((100, 100, 4), dtype=np.uint8), duration=1.0) >>> layer2 = mv.layer.Image(np.zeros((100, 100, 4), dtype=np.uint8), duration=1.0) >>> composition = mv.tile([layer1, layer2], rows=1, cols=2) # tile 1x2 >>> composition.duration 1.0 >>> composition.size (200, 100)