Image Compare¶
marimo.image_compare
¶
image_compare(before_image: ImageLike, after_image: ImageLike, value: float = 50, direction: Literal['horizontal', 'vertical'] = 'horizontal', width: Optional[Union[int, str]] = None, height: Optional[Union[int, str]] = None) -> Html
Render an image comparison slider to compare two images side by side.
Examples:
# With custom settings
mo.image_compare(
before_image="original.png",
after_image="processed.png",
value=30, # Initial slider position at 30%
direction="vertical",
width=500,
height=400,
)
PARAMETER | DESCRIPTION |
---|---|
before_image
|
The "before" image to show in the comparison slider. Can be a path, URL, or array-like object.
TYPE:
|
after_image
|
The "after" image to show in the comparison slider. Can be a path, URL, or array-like object.
TYPE:
|
value
|
Initial position of the slider (0-100), defaults to 50.
TYPE:
|
direction
|
Orientation of the slider, either "horizontal" or "vertical". Defaults to "horizontal".
TYPE:
|
width
|
Width of the component in pixels or CSS units. |
height
|
Height of the component in pixels or CSS units. |
RETURNS | DESCRIPTION |
---|---|
Html
|
|