Kino.Image (Kino v0.2.0) View Source

A struct wrapping 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

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

Link to this section Summary

Functions

Wraps the given binary content into the image struct.

Link to this section Types

Specs

common_image_type() :: :jpeg | :png | :gif | :svg

Specs

mime_type() :: binary()

Specs

t() :: %Kino.Image{content: binary(), mime_type: mime_type()}

Link to this section Functions

Specs

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

Wraps the given binary content into the image struct.

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