View Source Kino.Image (Kino v0.11.3)
A kino for rendering a binary image.
This is just a meta-struct that implements the
protocol, so that it gets rendered as the underlying image.
content = File.read!("/path/to/image.jpeg") Kino.Image.new(content, "image/jpeg")
Link to this section Summary
Link to this section Types
Link to this section Functions
Creates a new kino similarly to
new/2 from a compatible term.
Currently the supported terms are:
Nx.Tensorin HWC order
Creates a new kino displaying the given binary image.
The given type be either
or a string with image MIME type.
Note that a special
image/x-pixel MIME type is supported. The
binary consists of the following consecutive parts:
- height - 32 bits (unsigned big-endian integer)
- width - 32 bits (unsigned big-endian integer)
- channels - 8 bits (unsigned integer)
- data - pixel data in HWC order
Pixel data consists of 8-bit unsigned integers. The number of channels can be either: 1 (grayscale), 2 (grayscale + alpha), 3 (RGB), or 4 (RGB + alpha).