Skip to main content
Render an image as HTML.

Usage

Signature

Parameters

ImageLike
required
A path or URL to an image, a file-like object (opened in binary mode), or array-like object.
Optional[str]
default:"None"
The alt text of the image.
Optional[Union[int, str]]
default:"None"
The width of the image in pixels or a string with units.
Optional[Union[int, str]]
default:"None"
The height of the image in pixels or a string with units.
bool
default:"False"
Whether to round the corners of the image.
Optional[dict[str, Any]]
default:"None"
A dictionary of CSS styles to apply to the image.
Optional[str]
default:"None"
The caption of the image.

Returns

An Html object.

Supported Input Types

The src parameter accepts:
  • str: Path or URL to an image
  • bytes: Image data as bytes
  • io.BytesIO: File-like object in binary mode
  • io.BufferedReader: Buffered file reader
  • Path: pathlib.Path object
  • Array-like objects: lists, numpy arrays, torch tensors, jax arrays, scipy sparse matrices
For array-like objects, the image will be normalized and converted to PNG format.