movis.ops.crop#
- movis.ops.crop(layer: BasicLayer, rect: tuple[int, int, int, int]) _CropLayer [source]#
Crop a layer from a specified rectangle.
- Args:
- layer:
Layer to crop.
- rect:
Rectangle to crop. (x, y, width, height)
- Returns:
Composition with the layer cropped.
- Examples:
>>> import movis as mv >>> layer = mv.layer.Image("image.png", duration=1.0) >>> composition = mv.crop(layer, (10, 20, 100, 200)) # crop from (10, 20) with size (100, 200) >>> composition.duration 1.0 >>> composition.size (100, 200)