notebook/image
src/notebook/image.tur
image hook, PNG encoding, and terminal image display.
defn
image-marker
(image-marker :cstr)
the stdout prefix used to signal an image path.
defn
image-hook-record-path
(image-hook-record-path [path :cstr])
record an image path via the stdout marker.
Parameters
| path | filesystem path to the PNG file |
Returns
0 (always)
Example
(image-hook-record-path "/tmp/cell-3-plot.png")
Since: Phase NB11
defn
image-hook-install
(image-hook-install [session :int] :int)
no-op stub (capture is handled by session-eval).
Parameters
| session | notebook session handle (ignored) |
Returns
0
Example
(image-hook-install session)
Since: Phase NB11
defn
image-hook-take
(image-hook-take [session :int] :int)
no-op stub; image paths live in cell-output.image-paths.
Parameters
| session | notebook session handle (ignored) |
Returns
0 (nil list; real paths are in cell-output returned by session-eval)
Example
(image-hook-take session)
Since: Phase NB11
defn
png->data-url
(png->data-url [path :cstr])
read a PNG file and return a base64 data URL.
Parameters
| path | filesystem path to a PNG file |
Returns
A :cstr of the form "data:image/png;base64,<encoded>" on success, or "" if the file cannot be read.
Example
(png->data-url "/tmp/plot.png") ; => "data:image/png;base64,iVBOR..."
Since: Phase NB11
defn
image-display-tui
(image-display-tui [path :cstr])
render an image path in the terminal.
Parameters
| path | filesystem path to a PNG file |
Returns
0 (always; output is printed to stdout as a side effect)
Example
(image-display-tui "/tmp/cell-3-plot.png")
Since: Phase NB11 (AN5: delegated to ansi/image; v0.1.2: sixel via tur-png)
Internal definitions
__img-result-handle