Skip to content

Image

marimo.image

image(
    src: ImageLike,
    alt: str | None = None,
    width: int | str | None = None,
    height: int | str | None = None,
    rounded: bool = False,
    style: dict[str, Any] | None = None,
    caption: str | None = None,
) -> Html

Render an image as HTML.

Examples:

# Render an image from a local file
mo.image(src="path/to/image.png")
# Render an image from a URL
mo.image(
    src="https://marimo.io/logo.png",
    alt="Marimo logo",
    width=100,
    height=100,
    rounded=True,
    caption="Marimo logo",
)
PARAMETER DESCRIPTION
src

a path or URL to an image, a file-like object (opened in binary mode), or array-like object.

TYPE: ImageLike

alt

the alt text of the image

TYPE: str | None DEFAULT: None

width

the width of the image in pixels or a string with units

TYPE: int | str | None DEFAULT: None

height

the height of the image in pixels or a string with units

TYPE: int | str | None DEFAULT: None

rounded

whether to round the corners of the image

TYPE: bool DEFAULT: False

style

a dictionary of CSS styles to apply to the image

TYPE: dict[str, Any] | None DEFAULT: None

caption

the caption of the image

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
Html

Html object