View Source Kino.Image (Kino v0.10.0)

A kino for rendering a binary image.

This is just a meta-struct that implements the Kino.Render protocol, so that it gets rendered as the underlying image.

examples

Examples

content = File.read!("/path/to/image.jpeg")
Kino.Image.new(content, "image/jpeg")

Link to this section Summary

Functions

Creates a new kino similarly to new/2 from a compatible term.

Creates a new kino displaying the given binary image.

Link to this section Types

@type common_image_type() :: :jpeg | :jpg | :png | :gif | :svg | :pixel
@type mime_type() :: binary()
@opaque t()

Link to this section Functions

@spec new(struct()) :: t()

Creates a new kino similarly to new/2 from a compatible term.

Currently the supported terms are:

@spec new(binary(), common_image_type() | mime_type()) :: t()

Creates a new kino displaying the given binary image.

The given type be either :jpeg/:jpg, :png, :gif, :svg, :pixel or a string with image MIME type.

Note that a special :pixel format is supported, see Kino.Output.image/0 for the specification.