Helper functions to simplify rendering images in Kino.
Note
This module is only available if the optional dependency
Kino is configured in
mix.exs.
Summary
Functions
@spec show(image :: Vix.Vips.Image.t(), options :: Keyword.t()) :: Kino.Image.t()
Renders an image in Kino.
Arguments
imageis anyVix.Vips.Image.t/0.optionsis a keyword list of options.
Options
:max_heightdetermines the maximum height for the rendered image. The aspect ratio of the rendered image is unchanged. The default is200.
Returns
maybe_resized_imageof typeKino.Image.t/0.
Examples
The return value is a Kino widget rendered by the Livebook runtime, so these are shown as code rather than as doctests.
# Render at the default maximum height
Image.Kino.show(image)
# Render no taller than 200 pixels, keeping the aspect ratio
Image.Kino.show(image, max_height: 200)