movis.layer.media.Image#

class movis.layer.media.Image(img_file: str | PathLike | Image | ndarray, duration: float = 1000000.0)[source]#

Still image layer to encapsulate various formats of image data and offer time-based keying.

Args:
img_file: the source of the image data. It can be a file path (str or PathLike),

a PIL.Image object, or a two or three-dimensional numpy.ndarray with a shape of (H, W, C).

duration: the duration for which the image should be displayed.

Default is 1000000.0 (long enough time).

Methods

classmethod from_color(size: tuple[int, int], color: str | tuple[int, int, int], duration: float = 1000000.0) Image[source]#

Create a plain image with a given color.

Args:
size:

the size of the image with a tuple of (width, height).

color:

the color of the image. It can be a color name (str) or a tuple of (R, G, B).

duration:

the duration for which the image should be displayed. Default is 1000000.0 (long enough time).

Returns:

An Image object.

get_key(time: float) bool[source]#

Get the state index for the given time.

Attributes

duration

The duration for which the image should be displayed.

image

The image data.

size

The size of the image with a tuple of (width, height).