neuralset.events.etypes.Image

class neuralset.events.etypes.Image(*, start: float, timeline: str, duration: Annotated[float, Ge(ge=0)] = 0.0, extra: dict[str, Any] = {}, filepath: Path | str = '', frequency: float = 0, caption: str = '')[source][source]

Image event with optional caption.

Requires pillow>=9.2.0 to be installed.

Parameters:

caption (str, optional) – Caption or description of the image. Multiple captions should be newline-separated. Default: “”

Returns:

RGB PIL Image object when read() is called

Return type:

PIL.Image

Warning

Image events with duration <= 0 will be logged as ignored

Examples

img_event = Image(start=1.0, timeline="exp", filepath="img.jpg",
                 duration=2.0, caption="A cat")
pil_image = img_event.read()